Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Master Index
Master Index
Go to Feedback page

Connecting to the Oracle Database

Once you have obtained an interface, you can use it to establish a user session in an Oracle database by invoking the OpenDatabase method.

Set EmpDb= OO4OSession.OpenDatabase("ExampleDb", "Scott/Tiger", 0)


Set EmpDb= OO4OServer.OpenDatabase("Scott/Tiger")

The variable EmpDb represents a user session. It holds an OraDatabase interface and can be used to send commands to the Oracle database using ExampleDb for the network connection alias and "scott/tiger" for the username and password.

The OraServer interface allows multiple user sessions to share a physical network connection to the database server. This reduces resource usage on the network and the database server, and allows for better server scalability. However, execution of commands by multiple user sessions is serialized on the connection. Therefore, this feature is not recommended for use in multithreaded applications in which parallel command execution is needed for performance.

The following code shows how to use the OraServer interface to establish two user sessions.

Set OO4OServer = CreateObject("OracleInProcServer.XOraServer")


Set EmpDb1 = OO4OServer.OpenDatabase("Scott/Tiger")

Set EmpDb2 = OO4OServer.OpenDatabase("Scott/Tiger")

NOTE: You can also obtain user sessions from a previously created pool of objects. For a discussion on how to use this feature, see Using the Connection Pool Management Facility.