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
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.
Example
Perl
use CQPerlExt;
#Start a DevOps Plan 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);