< Previous | Next >

Getting accessible databases

To get the accessible databases, you call the GetAccessibleDatabases method of the Session object.

About this task

The GetAccessibleDatabases method takes three arguments:
  • master_db_name

    A String that specifies the Rational® ClearQuest® 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).

The return value is a DatabaseDescs collection object. For example:
require CQPerlExt; 
#Start a Rational
ClearQuest session 
$sessionObj = CQSession::Build(); 
#Get a list of accessible databases 
$databases = $sessionObj->GetAccessibleDatabases("MASTR", "admin", ""); 
$count = $databases->Count(); 
#For each accessible database, get database name
for($x=0;$x<$count;$x++)
   { 
     $db = $databases->Item($x); 
     $dbName = $db->GetDatabaseName(); 
     #... 
   } 
CQSession::Unbuild($sessionObj);
< Previous | Next >