GetAccessibleDatabases

Description

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.

Note: The GetAccessibleDatabases method does not require a user login; it can be called from a constructed Session object before a user login. If LDAP authentication is enabled, the user login name may not be the same as the DevOps Plan user name. See Impact on Existing APIs for more information.

Syntax

Perl


$session->GetAccessibleDatabases(master_db_name, user_login_name, 
database_set); 
Identifier
Description
session
The Session object that represents the current database-access session.
master_db_name
A String that specifies the DevOps Plan logical database name of the schema repository. In most cases, this value is "MASTR".
user_login_name
A String that specifies the user login name. Using an empty string for this argument tells this function to return a list of all databases associated with this schema repository, not just those accessible to a specific user.
database_set
A String that specifies the database set in which to look for accessible databases. By default, this argument should contain the empty String. This causes the function to use the product-default database set name (that is, the product version number).
Return value

An Array of Variants each containing a DatabaseDescs Object collection.

Example

Perl


use CQPerlExt;

#Start a DevOps Plan 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);