GetDatabaseName

Description

Returns the name of the database.

You can use the Session object's GetAccessibleDatabases method to obtain a list of DatabaseDesc objects, and then use GetDatabaseName to get the name of each one. You use the name of the database as an argument to the Session object's UserLogon method.

Syntax

VBScript


dbDesc.GetDatabaseName 

Perl


$dbDesc->GetDatabaseName(); 
Identifier
Description
dbDesc
A DatabaseDesc object containing information about one of the installed databases.
Return value
A String containing the name of the database.

Examples

VBScript

The following example shows you how to log on to the database from a Visual Basic application.


set sessionObj = CreateObject("CLEARQUEST.SESSION")

' Login to each database successively. 
databases = sessionObj.GetAccessibleDatabases("MASTR","","")
For Each db in databases 
   If Not db.GetIsMaster Then 
      dbName = db.GetDatabaseName 
      `Logon to the database 
      sessionObj.UserLogon "tom", "gh36ak3", dbName, AD_PRIVATE_SESSION, ""
   End If
  ' ... 
Next 

Perl


use CQPerlExt;

#Start a HCL Compass session
$sessionObj = CQSession::Build();


#Get a list of accessible databases

$databases = $sessionObj->GetAccessibleDatabases("MASTR", "", "");

#Get the number of databases

$count = $databases->Count();

# Foreach accessible database, get the dbName and

# login as joe with password gh36ak3

for($x=0;$x<$count;$x++){

   $db = $databases->Item($x);

   $dbName = $db->GetDatabaseName();

      # Logon to the database 

   $sessionObj->UserLogon( "joe", "gh36ak3", $dbName, "" );

   #...

   }

CQSession::Unbuild($sessionObj);