Databases and Connections
This section describes the arguments used to create an instance of RWDBDatabase for the DB Access module of PostgreSQL. In order for a SourcePro DB 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 connection string which is passed to the libpq function PQconnectdb.
The arguments you must provide to RWDBManager::database() are:
*accessLib: If your DB Access Module for PostgreSQL is compiled as a DLL or shared library, provide the name of the DLL or shared library. See the document Building Your Applications for information about naming conventions. If you are using a static library, supply the string "POSTGRESQL".
*serverName: Supply the name of the PostgreSQL host. Or, for direct control of connection parameters, pass a full connect string of the form required by PQconnectdb(); for example:
For example:
"host = somehost user = someUser dbname = someDBname"
In this case, the string is passed to PQconnectdb() without modification, and the userName, passWord, and databaseName parameters are ignored.
*userName: Supply a login of a valid user.
*passWord: Supply the password for the login specified by userName.
NOTE: You can instead provide a password using the callback API, which may provide more security. For more information, see Chapter 10, “Callbacks” in the DB Interface Module User’s Guide.
*databaseName: Supply the name of the PostgreSQL database to use.