This section describes the arguments required to create an RWDBDatabase instance for DB-Library. In order for a DBTools.h++ application to open and use the connections required for interacting with a database, you must first create an RWDBDatabase instance by calling
RWDBManager::database(accessLib, serverName, userName, passWord, databaseName);
All arguments are of type RWCString. For DB-Library, you must provide the following arguments:
accessLib: If you are using DLLs or shared libraries, provide the name of the shared library or DLL. If you are using a static library, supply the string SYBASE. See the DBTools.h++ Build Guide for information about naming conventions.
serverName: Supply the name of the SQL Server to which you wish to connect, as found in your local interfaces, sql.ini or win.ini file.
userName: Supply the SQL Server login name for a valid user.
passWord: Supply the password for the user.
databaseName: You can optionally supply the name of an SQL server database to use. If this parameter is not supplied, the default database of the specified user is used.
Here are three examples of opening a database on a specific SQL server, INHOUSE.
The first example opens a specific database, ACCOUNTING. Both a user name and a password are given to provide the highest level of security. Notice that the accessLib is defined as SYBASE, indicating that the application must be linked with the static version of the access library:
RWDBManager::database("SYBASE", "INHOUSE", "cratchitt", "scrooge", "ACCOUNTING");
The second example shows how to open the same database from a Windows application. In this case, the accessLib is defined as sdb4d.dll, indicating that the application will dynamically load (DLL) the access library at runtime:
RWDBManager::database("sdb4d.dll", "INHOUSE", "cratchitt", "scrooge", "ACCOUNTING");
The final example shows how to open a user's default database, which is the database assigned to the user by the database administrator. In this case, the application will use the access library as an Unix shared library at runtime:
RWDBManager::database("libsdb0d.so", "INHOUSE", "cratchitt", "scrooge", "");
The library name and path shown are for Solaris.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.