Oracle Objects for OLE C++ Class Library Release 9.2 Part Number A95896-01 |
|
Applies To
Description
This method sets up a session.
Usage
oresult Open(void);
oresult Open(const char *sessname)
Arguments
sessname |
The name to be given to the new session |
This method opens an OSession object.
Every application that uses Oracle Objects for OLE is assigned a default session. The name of the default session is internally generated. By using the Open method with no arguments, you open an OSession object that refers to the default session for your application. Open can be called multiple times with a void argument and each time it gives you a handle of the default session. This is the only case in the class library where multiple Opens give you the same object.
To create another session, to have a separate transaction group, or to refer to a session by name, open the session and specify its name with the sessname argument. The Open attempts to create a new session of that name. To obtain an open OSession object on an existing named session, get it from an OSessionCollection object. It is not possible to share sessions across applications, only within applications.
Return Value
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Example
Open a session:
// open the default session
OSession defaultsess;
defaultsess.Open();
// and open a separate session
OSession sess2;
sess2.Open("session2");
// Now if we create databases on these . . .
ODatabase odb(defaultsess, "ExampleDB", "scott", "tiger");
ODatabase odb2(sess2, " ExampleDB", "scott", "tiger ");
// . . . performing transactions on odb will not affect odb2
// and vice versa, because they are in separate sessions.
|
Copyright © 1998, 2002 Oracle Corporation. All Rights Reserved. |
|