Using a Connection String
For some applications, you might need to use a connection string to connect to your data source. For detailed information about how to use a connection string in an ODBC application, refer to the documentation for the application that you are using.
The connection strings in the following sections are examples showing the minimum set of connection attributes that you must specify to successfully connect to the data source. Depending on the configuration of the data source and the type of connection you are working with, you might need to specify additional connection attributes. For detailed information about all the attributes that you can use in the connection string, see Connector Configuration Options.
DSN Connection String Example
The following is an example of a connection string for a connection that uses a DSN:
DSN=[DataSourceName]
[DataSourceName] is the DSN that you are using for the connection.
You can set additional configuration options by appending key-value pairs to the connection string. Configuration options that are passed in using a connection string take precedence over configuration options that are set in the DSN.
DSN-less Connection String Examples
Some applications provide support for connecting to a data source using a connector without a DSN. To connect to a data source without using a DSN, use a connection string instead.
The placeholders in the example are defined as follows, in alphabetical order:
- [PortNumber] is the number of the TCP port that the SQL Server instance uses to listen for client connections.
- [ServerInfo] is the IP address or host name of the SQL Server instance to which you are connecting.
- [ServiceName] is the Kerberos service principal name of the SQL Server instance.
- [SQLServerDatabase] is the name of the database that you want to access.
- [YourPassword] is the password corresponding to your user name.
- [YourPath] is the file path corresponding to the file containing your authentication token.
- [YourUserName] is the user name that you use to access the SQL Server instance.
Connecting to a SQL Server Instance Using User Login
The following is an example of a DSN-less connection string for a connection to a SQL Server instance that requires user login:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];
Port=[PortNumber];Database=[SQLServerDatabase];
UID=[YourUserName];PWD=[YourPassword];
For example:
Driver=Simba SQL Server ODBC Driver;
Server=192.168.222.160;Port=1500;Database=TestDB;
UID=simba;PWD=simba;
Connecting to a SQL Server Instance Using Kerberos Authentication
- The connector accepts both
Integrated_Security
andIntegrated Security
. - The connector accepts both
Server_SPN
andServerSPN
.
The following is an example of a DSN-less connection string for a connection to a SQL Server instance that requires authentication through Kerberos:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];
Port=[PortNumber];Database=[SQLServerDatabase];
Trusted_Connection=true;Integrated_Security=true;
Server_SPN=[ServiceName];
For example:
Driver=Simba SQL Server ODBC Driver;
Server=192.168.222.160;Port=1500;Database=TestDB;
Trusted_Connection=true;Integrated_Security=true;
Server_SPN=sqls;
Connecting to a SQL Server Instance Using NTLM Authentication
Integrated_Security
property, which is included in the examples below, the connector also accepts Integrated Security
as a valid spelling of the property name.
The following is an example of a DSN-less connection string for a connection to a SQL Server instance that requires authentication through the NTLM protocol:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];
Port=[PortNumber];Database=[SQLServerDatabase];
Integrated_Security=true;Trusted_Connection=NTLM;
UID=[YourUserName];PWD=[YourPassword];
For example:
Driver=Simba SQL Server ODBC Driver;
Server=192.168.222.160;Port=1500;Database=TestDB;
Integrated_Security=true;Trusted_Connection=NTLM;
UID=domain\simba;PWD=simba;
Connecting to a SQL Server Instance on Azure Using an Authentication Type
The following is an example of a DSN-less connection string for a connection to a SQL Server instance through the Azure SQL Database protocol and an authentication type:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];AuthenticationType=SQLServerTDSAuth;Database=[SQLServerDatabase];UID=[YourUserName];PWD=[YourPassword];Encrypt=false;
For example:
Driver=Simba SQL Server ODBC Driver;
Server=10.10.10.10;AuthenticationType=SQLServerTDSAuth;Database=TestDB;UID=domain\simba;PWD=simba;Encrypt=false;
Connecting to a SQL Server Instance on Azure Using an Authentication Token
- This feature is only available in Windows and Linux.
- in Linux, the path to the .NET installation directories must be set before using OAuth authentication. This can be done by running the
exportPath.sh
script, located in theThirdParty
folder, contained in the connector library file. - For example, if the connector library file is present in
/opt/simba/mysqlodbc/lib
, execute the following steps to set the .NET directories path:- Navigate to
/opt/simba/mysqlodbc/lib/ThirdParty
. - Execute the script with the following command:
source exportPath.sh
.
- Navigate to
- If the script does not execute successfully, the connector fails to create connections.
- For this feature, the connector requires that .NET 6.0.3 or higher be installed on your system. The library can be downloaded from: https://dotnet.microsoft.com/en-us/download.
The following is an example of a DSN-less connection string for a connection to a SQL Serverinstance that requires authentication through the Azure SQL Database protocol and an authentication token:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];AuthenticationType=OauthAzureAuthentication;AuthenticationFile=[YourPath];
For example:
Driver=Simba SQL Server ODBC Driver;
Server=sqlserverwp.database.windows.net;AuthenticationType=OauthAzureAuthentication;AuthenticationFile=C:\SecureFiles\AuthToken.txt;
Connecting to a SQL Server Instance on Azure Using User Login
- This feature is only available in Windows and Linux.
- in Linux, the path to the .NET installation directories must be set before using OAuth authentication. This can be done by running the
exportPath.sh
script, located in theThirdParty
folder, contained in the connector library file. - For example, if the connector library file is present in
/opt/simba/mysqlodbc/lib
, execute the following steps to set the .NET directories path:- Navigate to
/opt/simba/mysqlodbc/lib/ThirdParty
. - Execute the script with the following command:
source exportPath.sh
.
- Navigate to
- If the script does not execute successfully, the connector fails to create connections.
- For this feature, the connector requires that .NET 6.0.3 or higher be installed on your system. The library can be downloaded from: https://dotnet.microsoft.com/en-us/download.
The following is an example of a DSN-less connection string for a connection to a SQL Server instance that requires authentication through the Azure SQL Database protocol and a user login:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];AuthenticationType=OauthAzureUsernamePasswordAuthentication;UID=[YourUserName];PWD=[YourPassword];
For example:
Driver=Simba SQL Server ODBC Driver;
Server=sqlserverwp.database.windows.net;AuthenticationType=OauthAzureUsernamePasswordAuthentication;
UID=domain\simba;PWD=simba;
Connecting to a SQL Server Instance on Azure Using User Login With Interactive Authentication
- This feature is only available in Windows and Linux.
- in Linux, the path to the .NET installation directories must be set before using OAuth authentication. This can be done by running the
exportPath.sh
script, located in theThirdParty
folder, contained in the connector library file. - For example, if the connector library file is present in
/opt/simba/mysqlodbc/lib
, execute the following steps to set the .NET directories path:- Navigate to
/opt/simba/mysqlodbc/lib/ThirdParty
. - Execute the script with the following command:
source exportPath.sh
.
- Navigate to
- If the script does not execute successfully, the connector fails to create connections.
- For this feature, the connector requires that .NET 6.0.3 or higher be installed on your system. The library can be downloaded from: https://dotnet.microsoft.com/en-us/download.
The following is an example of a DSN-less connection string for a connection to a SQL Server instance that requires authentication through the Azure SQL Database protocol and a user login with interactive authentication:
Driver=Simba SQL Server ODBC Driver;Server=[ServerInfo];AuthenticationType=OauthAzureInteractiveAuthentication;UID=[YourUserName]
For example:
Driver=Simba SQL Server ODBC Driver;
Server=sqlserverwp.database.windows.net;AuthenticationType=OauthAzureInteractiveAuthentication;UID=domain\simba;