Data Access User Manual > Data Access and SQL > Connecting to a Database > SQL Sessions and Cursor Objects > Connecting to a Database System
 
Connecting to a Database System
Once you have created a session object, you can connect to the database system using the connect member function. This is done in the following way:
if (session->connect()) {
...
}
else
IlvPrint(“Error: %s”, session->getErrorMessage().getMessage());
During the session, you can check whether the session is still connected using the isConnected member function. An example of this is shown in the following code:
if (!session->isConnected())
IlvPrint(“Not connected”);
To end a session, use the disconnect member function. This method rolls back any (uncommitted) work in progress and breaks the communication channel with the database system.
session->disconnect();

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.