Returns a list of databases that are available for the specified user to log in to.
This method returns only the databases that the specified user is allowed to log in to. If the user_login_name parameter contains an empty String, this method returns a list of all of the databases associated with the specified schema repository (master database).
You can examine each DatabaseDesc object to get the corresponding database name, database set name and other information needed to log in to it.
VBScript
session.GetAccessibleDatabases (master_db_name, user_login_name, database_set)
Perl
$session->GetAccessibleDatabases(master_db_name, user_login_name, database_set);
For Perl, a DatabaseDescs Object collection.
VBScript
set sessionObj = GetSession ' Get the list of databases in the ' master database set. databases = sessionObj.GetAccessibleDatabases("MASTR","admin","") for each db in databases ' Get the name of the database dbName = db.GetDatabaseName sessionObj.UserLogon "admin", "", dbName, AD_PRIVATE_SESSION, "" dbConnectString = db.GetDatabaseConnectString Next The following code provides a MsgBox indicating the connect vendor information and logical name for all the user databases in a specific dbset. Sub Test() Dim session Dim databases Dim dbConnectString Dim dbConnectName Dim db Set session = CreateObject("CLEARQUEST.SESSION") databases = session.GetAccessibleDatabases("MASTR", "admin", "") session.UserLogon "admin", "", "SAMPL", AD_PRIVATE_SESSION, "" For Each db In databases dbConnectString = db.GetDatabaseConnectString dbConnectName = db.GetDatabaseName MsgBox dbConnectString MsgBox dbConnectName Next End Sub
Perl
use CQPerlExt;
#Start a Rational ClearQuest session
$sessionObj = CQSession::Build();
#Get a list of accessible databases
$databases = $sessionObj->GetAccessibleDatabases("MASTR", "admin", "");
$count = $databases->Count();
#Foreach accessible database, 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);