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, .

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 examples are defined as follows, in alphabetical order:

  • [DBService] is service name of the database that you want to access.
  • [PortNumber] is the number of the TCP port that the Oracle server uses to listen for client connections.
  • [Server] is the IP address or host name of the Oracle server to which you are connecting.
  • [TNSName] is the net service name from your tnsnames.ora file that you want to use for your connection.
  • [YourPassword] is the password corresponding to your user name.
  • [YourUserName] is the user name that you use to access the Oracle server.

Connecting to Oracle Using Your Oracle Database Credentials

The following is the format of a DSN-less connection string for connecting to Oracle using your database credentials:

Driver=Simba Oracle ODBC Driver;Host=[Server];
Port=[PortNumber];SVC=[DBService];UID=[YourUserName];
PWD=[YourPassword];

For example:

Driver=Simba Oracle ODBC Driver;Host=192.168.222.160;
Port=1521;SVC=ORCL;UID=jsmith;PWD=simba123;

If you are connecting to the server through SSL, then set the UseTCPS property to true. For example:

Driver=Simba Oracle ODBC Driver;Host=192.168.222.160;
Port=2484;SVC=ORCL;UID=jsmith;PWD=simba123;
UseTCPS=true;

Connecting to Oracle Using Kerberos

The following is the format of a DSN-less connection string for connecting to Oracle using the Kerberos protocol:

Driver=Simba Oracle ODBC Driver;Host=[Server];
Port=[PortNumber];SVC=[DBService];UseExternalCredentials=true;

For example:

Driver=Simba Oracle ODBC Driver;Host=192.168.222.160;
Port=1521;SVC=ORCL;UseExternalCredentials=true;

If you are connecting to the server through SSL, then set the UseTCPS property to true. For example:

Driver=Simba Oracle ODBC Driver;Host=192.168.222.160;
Port=2484;SVC=ORCL;UseExternalCredentials=true;
UseTCPS=true;

Important: You cannot use the Simba Oracle ODBC Driver to connect to an Oracle Autonomous Data Warehouse instance using Kerberos authentication.

Connecting to Oracle Through TNS

The following is the format of a DSN-less connection string for connecting to a Oracle through TNS. In this example, the connector authenticates the connection using Oracle database credentials; however, you can configure the connector to authenticate through Kerberos instead, as shown in the examples above.

Driver=Simba Oracle ODBC Driver;TNS=[TNSName];
UID=[YourUserName];PWD=[YourPassword];

For example:

Driver=Simba Oracle ODBC Driver;TNS=oracleconnection1;
UID=jsmith;PWD=simba123;

If you are connecting to the server through SSL, make sure that the TNS_ADMIN environment variable on your machine points to a tnsnames.ora configuration file that contains the necessary SSL settings. For more information, see Configuring SSL VerificationConfiguring SSL Verification.