Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

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)

or

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")

OO4OServer.Open("ExampleDb")

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.


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback