SQL Sessions and Cursor Objects
The
IliSQLSession class establishes a communication channel with a remote database engine. An instance of this class is created whenever you connect to a relational database using the Connect panel in Views Studio.
Each SQL data source in Data Access has an
IliSQLTable object which in turn has an
IliSQLSession object. These session objects are usually associated with one and only one SQL data source. However, if you create an application-wide SQL session, it can be associated with more than one SQL data source. See
Registered Sessions.
Creating a Session
An
IliSQLSession object is automatically created when you connect to the database using the connect panel in Views Studio. An example of how the
IliSQLSession object is created is shown in the following code:
IliSQLSession* session;
session = new IliSQLSession(“oracle10”, “scott/tiger@options”);
session->lock();
...
session->unLock();
The first parameter in the IliSQLSession constructor is the name of the database driver. This can be any of the following names: “oracle”,“oracle9”,“oracle10”, “oracle11”, “sybase”, “informix”, “informix72”,“informix9”,“oledb”, “mssql” or “odbc” (for the set of databases that are currently supported).
The second parameter designates the user, password, and other connection parameters required to establish the communication with the remote database engine. Its format depends on the database driver used. See
getConnectionParams in the Views
Data Access Reference Manual.After obtaining an
IliSQLSession object you should lock it and keep it locked until you have finished using it. When you have finished with the session, the
IliRefCounted::unLock member function should be called to unlock the session.
Published date: 05/24/2022
Last modified date: 02/24/2022