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 DevOps Plan application.
Note: You must log in with Super_User privilege or an error will be
generated by GetDatabaseConnectString.
Syntax
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.
Example
Perl
use CQPerlExt;
#Start a DevOps Plan
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);