Tuesday, December 11, 2007

How to get the db connection string with CQ admin user


How to get the db connection string with CQ admin user

We can get the dbo userid, pwd, physical database name via some database object description  API. Here is the perl sample,

# Perl begins
#!C:\Program Files\Rational\ClearQuest\cqperl.exe

use CQPerlExt;

# create user session
my $userSession=CQSession::Build();
     $userSession->UserLogon("userid","pwd","userdb_name","schema_repository_name");
my $dbObjDes=$userSession->GetSessionDatabase()
print $dbObjDes->GetDatabaseConnectString();

# End

After run above pl file agaist MSSQL server, you can get the output like:

DRIVER={SQL Server};UID=dboname;DATABASE=physical_dbs;PWD=pwdabc;SERVER=db_servername

No comments: