A DSN-less connection enables you to specify the required parameters, such as the driver name, authentication details, and server information, directly in a connection string without having to configure a DSN in the ODBC Data Source Administrator.
You can create a DSN-less connection by directly specifying all the connection parameters in the string.
DRIVER={Devart ODBC Driver for Salesforce};Server=login.salesforce.com;User ID=your_salesforce_username;Password=your_salesforce_password;Security Token=your_salesforce_security_token
The connection string contains the following parameters:
Driver:
The driver name.
Server:
The Salesforce server you are connecting to. Use login.salesforce.com
for production or test.salesforce.com
for a sandbox environment.
User ID:
The Salesforce username.
Password:
The Salesforce password.
Security Token:
The security token for your Salesforce account.
DRIVER={Devart ODBC Driver for Salesforce};Authentication=OAuth;Server=login.salesforce.com;Refresh Token=your_salesforce_refresh_token
The connection string contains the following parameters:
Driver
: The driver name.
Authentication
: Authentication type.
Server
: The Salesforce server you are connecting to. Use login.salesforce.com
for production or test.salesforce.com
for a sandbox environment.
Refresh Token
: The refresh token for your Salesforce account.
DRIVER={Devart ODBC Driver for Salesforce};Description=Devart ODBC Driver for Salesforce;Server=login.salesforce.com;User ID=your_user_id;Password=your_password;Proxy Server=your_proxy_server;Proxy Port=8080;Proxy User=your_proxy_username;Proxy Password=your_proxy_password;Security Token=your_salesforce_security_token
The connection string contains the following parameters:
Driver
: The driver name.
Server
: The Salesforce server you are connecting to. Use login.salesforce.com
for production or test.salesforce.com
for a sandbox environment.
User ID
: The Salesforce username.
ProxyServer
: The proxy hostname or IP address.
ProxyPort
: The proxy port.
ProxyUser
: The proxy username.
ProxyPassword
: The proxy password.
Security Token
: The security token for your Salesforce account.
You can test the DSN-less connection by running your application or using tools such as isql or ODBC Test to verify that the connection is established successfully.
The following example uses the New-Object cmdlet to create an ODBC connection.
$ConnectionString = "DRIVER={Devart ODBC Driver for Salesforce};Server=https://login.salesforce.com;User ID=your_username;Password=your_password;Security Token=your_security_token;"
try {
$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString = $ConnectionString
$conn.Open()
Write-Host "Connection successful!"
$conn.Close()
} catch {
Write-Host "Connection failed: $_"
}
Devart ODBC Driver for Salesforce allows configuring additional parameters to customize the connection and the driver’s behavior. For a full list of available parameters, see Salesforce ODBC connection string parameters.
using System;
using System.Data.Odbc;
class Program
{
static void Main()
{
string connectionString = "DRIVER={Devart ODBC Driver for Salesforce};User ID=your_salesforce_username;Password=your_salesforce_password;Security Token=your_salesforce_security_token;Server=login.salesforce.com;Port=443;";
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
connection.Open();
Console.WriteLine("Connected to Salesforce!");
// Perform your queries or operations here.
}
}
}