GetDatabaseConnectString
Description
Returns the "direct connect" string for logging into the database.
This method returns a database-specific "direct connect"
string suitable for passing to an ODBC interface. The normal way of
logging into a database is by invoking the Session object's UserLogon
method.
This method can be useful for experts who want to use DAO or other
ODBC methods to read the HCL Compass database.
Note: You must log in with Super_User privilege
or an error will be generated by GetDatabaseConnectString
Syntax
VBScript
dbDesc.GetDatabaseConnectString
Perl
$dbDesc->GetDatabaseConnectString
();
- Identifier
- Description
- dbDesc
- A DatabaseDesc object containing information about one of the installed databases.
- Return value
- A String whose value is the "direct connect" string.
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
dbName = db.GetDatabaseName
sessionObj.UserLogon "admin", "", dbName, AD_PRIVATE_SESSION, ""
dbConnectString = db.GetDatabaseConnectString
Next
Perl
use CQPerlExt;
#Start a HCL Compass
session
$sessionObj = CQSession::Build();
#Get a list of accessible databases
$databases = $sessionObj->GetAccessibleDatabases("MASTR", "", "");
$count = $databases->Count();
#Foreach accessible database, login as joe with password gh36ak3
#joe must be a superuser
for($x=0;$x<$count;$x++){
$db = $databases->Item($x);
$dbName = $db->GetDatabaseName();
# Logon to the database
$sessionObj->UserLogon( "joe", "gh36ak3", $dbName, "" );
#Get a "direct connect" string that ODBC experts
#can use to logon to the database
$dbConnectString = $db->GetDatabaseConnectString();
}
CQSession::Unbuild($sessionObj);