Understanding connect strings

To connect to a database, you must pass a connect string to %SSC_CONNECT. A connect string contains the information needed to access a database, such as the database name, username, and password. The connect string also determines whether SQL OpenNet will be used for the network layer.

There are two forms of connect string:

db_driver:database_info
net:database_info@opennet_info

To access a local database (as illustrated in figure 1 below), use the first connect string form (starting with db_driver). There is an exception: for 32-bit SQL Connection applications that run on 64-bit Windows, use the second form (net:) for all connections, local and remote.

1. Connecting directly to a local database.

Connecting directly to a local database

To access a remote database, use the second connect string form (starting with net:), which uses SQL OpenNet. Your application will connect to the SQL OpenNet server specified by opennet_info and the database specified by database_info, as illustrated in figure 2. See Building connect strings for more information on these arguments.

2. Connecting to a remote database via SQL OpenNet.

Connecting to a remote database via SQL OpenNet

As an alternative for remote database access, you can connect directly (using the first form of the syntax) to a local database client for the remote database. However, unless you are using clustering, we recommend using SQL OpenNet instead (by using the second form of the syntax, which starts with net:). Using SQL OpenNet generally results in better performance, and the database driver does not need to be installed on each client, which is a requirement when connecting directly. Additionally, using SQL OpenNet when accessing a SQL Server database enables you to use the shared memory protocol, which otherwise would not be available for remote connections.

If you use clustering, you must use a direct connection to a database client for a remote database, as illustrated in figure 3. For failover protection, the connection must use the database’s network facilities rather than SQL OpenNet.

3. Connecting directly to a local database client for a remote database.

Connecting directly to a remote database