This is an old revision of the document!


Development: SQL

Connection Strings

Connections in ODBC

There are three typical methods for connecting to Omnidex through an ODBC Driver: Machine Datasources, File Datasources and DNS-less Connections. These three approaches all take advantage of Omnidex connection strings.

Machine Datasources

The standard ODBC interface provides the ability to create two types of Machine Datasources: System Datasources and User Datasources. When creating one of these datasources, the ODBC Data Source Administrator provided by Microsoft will automatically launch an Omnidex wizard to prompt you through the creation process. Complete instructions for using this wizard are available in the documentation on Omnidex's ODBC Interface.

Once the Machine Datasource has been created, it can be referenced in an ODBC call to either SQLConnect or SQLDriverConnect. In the following example, the name of the Machine Datasource is simple.

SQLConnect( hdbc, (SQLCHAR*) "simple",  SQL_NTS, NULL, 0, NULL, 0);
SQLDriverConnect( hdbc, NULL, (SQLCHAR*) "DSN=simple", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT); 

File Datasources

The standard ODBC interface provides the ability to create File Datasources. When creating a File Datasource, the ODBC Data Source Administrator provided by Microsoft will automatically launch an Omnidex wizard to prompt you through the creation process. Complete instructions for using this wizard are available in the documentation on Omnidex's ODBC Interface.

It is also possible to manually create File Datasources for Linux computers that run a Linux-based ODBC Manager, such as unixODBC. Consult the ODBC File DSN Syntax Specification for instruction on creating these files.

Once the File Datasource has been created, it can be referenced in an ODBC call to SQLDriverConnect.

SQLDriverConnect( hdbc, NULL, (SQLCHAR*) "FILEDSN=<name>", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);

DSN-Less Connection

Omnidex also allows ODBC applications to connect to an Environment File without the need for a Machine or File Datasource. All of the needed information is found in the connection string.

SQLDriverConnect( hdbc, NULL, 
                  (SQLCHAR*) "DRIVER={OMNIDEX}; CONNECTIONSTRING=[dbserver:7555]D:\\class\\simple.xml", 
                  SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);

Additional Resources

See also:

 
Back to top
dev/sql/connections/odbc.1294785007.txt.gz ยท Last modified: 2012/10/26 14:52 (external edit)