This section describes the arguments used to build a connect string to an Informix database. In order for a DBTools.h++ application to interact with a database, an RWDBDatabase instance must be created by calling:
RWDBManager::database(accessLib, serverName, userName, passWord, databaseName);
All arguments are of type RWCString. These parameters are used to build a connect string that is passed to the Informix ODBC Driver function SQLDriverConnect(). The string is of the form:
DSN=serverName; PWD=passWord; DB=databaseName; UID=userName
The arguments you must provide to RWDBManager::database() are:
accessLib: If your DBTools.h++ Informix Access Library is compiled as a DLL or shared library, provide the name of the DLL or shared library. See the Build Guide for information about naming conventions. If you are using a static library, supply the string "INFORMIX". This is a required parameter.
serverName: Supply the name of the data source to which you are connecting, as found in your ODBC control panel (Windows), or your .odbc.ini file (Unix); for example, "dbase_driver". Alternatively, supply a full connect string of the form required by SQLDriverConnect(), and it will be passed to SQLDriverConnect() without modification; for example, "DSN=someDataSource;UID=user;PWD=password". This is a required parameter.
userName: Supply the login of a valid user. Additionally, the user specified must have the necessary privileges (CONNECT, RESOURCE, or DBA) on the underlying database resources. Consult your Informix documentation to establish which user privilege is necessary for your application.
passWord: Supply the password for the user specified by userName.
databaseName: Supply the name of an Informix database to use.
Here are three examples of opening a database. The first example uses a driver to access a data source (DSN) named "inf33nt". A user name and password are provided, as well as a database: "ACCOUNTING". Notice that accessLib is defined as "inf4d.dll", indicating that the application will dynamically load (DLL) the access library at runtime:
RWDBDatabase aDB = RWDBManager::database ("inf4d.dll","inf33nt", "cratchitt", "scrooge", "ACCOUNTING");
In the second example, the accessLib is defined as "INFORMIX", indicating that the application must be linked with the static version of the access library:
RWDBDatabase aDB = RWDBManager::database ("INFORMIX","inf33nt", "cratchitt", "scrooge", "ACCOUNTING");
The third example uses a driver on a Unix machine to access the Informix9 data source (DSN). Notice that accessLib is defined as "libinf4d.so", indicating that the application will use the access library as a Unix shared library at runtime:
RWDBDatabase aDB = RWDBManager::database ("libinf4d.so", "Informix9", "cratchitt", "scrooge", "ACCOUNTING");
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.