Go to main content
Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 2 (10.2)

B14308-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

GetNamedSession Method

Applies To

OSession

Description

This method returns the session with the specified name by way of an OSession handle.

Usage

static OSession GetNamedSession(const char *sname)

Arguments

sname The name of the desired session.
Remarks

When sessions are created they are given a name. The GetNamedSession enables you to get a session based on that name. It is not possible to share sessions across applications, only within applications.

This routine is static, so it does not have to be invoked on an OSession object. It can be invoked as "OSession::GetNamedSession".

You can obtain the application’s default session by passing a NULL for sname.

Return Value

An OSession, which will be open on success, closed on failure.

Example

Getting sessions by name:

// we can obtain the default session:

OSession defsess = OSession::GetNamedSession(0);

// or we can get a session by name.

// Let’s create a session by name:

OSession newsess;

newsess.Open("sessname");

// now go get that session

OSession newscopy = OSession::GetNamedSession("sessname");

// by the way

oboolean isequal = (newscopy == newsess);

// isequal is TRUE