Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.2 Databases and Connections

This section describes the arguments used to build a connect string to an ODBC database. In order for a DBTools.h++ application to interact with a database, an RWDBDatabase instance must be created by calling:

All arguments are of type RWCString. These parameters are used to build a connect string which is passed to the ODBC API function SQLDriverConnect(). The string is of the form:

The arguments you must provide to RWDBManager::database() are:

Here are several examples of opening a database.

The first example uses a driver to access dBase tables found in the \dbfiles directory. A user name and password are not necessary. Notice that accessLib is defined as "odb4d.dll", indicating that the application will dynamically load (DLL) the access library at runtime:

The second example uses a driver to access Paradox tables found in the c:\paradox directory. Again, a user name and password are unnecessary, and omitted. Notice that accessLib is defined as "ODBC", indicating that the application must be linked with the static version of the access library:

The third example uses a driver to access Microsoft Access tables found in the e:\access directory. Again, a user name and password are not provided as they are unnecessary. Notice that accessLib is defined as "odb4d.dll", indicating that the application will dynamically load (DLL) the access library at runtime:

The fourth example uses a driver to access Microsoft and Sybase SQL servers. A user name and password are provided, as well as a database: "ACCOUNTING". Notice that accessLib is defined as "odb4d.dll", indicating that the application will dynamically load (DLL) the access library at runtime:

The final example uses a driver on a Unix machine to access Sybase SQL servers. Notice that accessLib is defined as "libodb4d.so", indicating that the application will use the access library as a Unix shared library at runtime:


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.