Oracle Objects for OLE
Release 9.0.1

Part Number A90173-01


Book List


Master Index


Connect 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 multi-threaded 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.

Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.


Book List