How to find out databases names attached to a Schema Repository using a Perl script in IBM Rational ClearQuest

Technote (FAQ)


Question

How do you find out databases names attached to a Schema Repository using a Perl script in IBM Rational ClearQuest?

Cause

You would want to find out names of the databases attached to a Schema Repository using Perl script and IBM Rational ClearQuest APIs; without using ClearQuest Designer.

Answer

The Perl Script below uses the ClearQuest API and can be run on Windows.

This script iterates through all the Databases in the provided Schema Repository and prints the name on command prompt.

Prerequisites:

The ClearQuest Client must be installed on this machine.

Procedure:

  1. Navigate to the location where CQperl.exe is installed.
    By default: C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

  2. Save the following Perl script text to notepad with a .pl extension.

    ***************************************************************
    #!C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe
    # Make sure you have correct path for CQperl.exe

    use CQPerlExt;

    # Create a Rational ClearQuest admin session
    $adminSession= CQAdminSession::Build();

    # Logon as admin
    # Provide correct login details
    $adminSession->Logon( "admin", "<AdminPassword>", "<SchemaRepositoryName>" );
    $dbList = $adminSession->GetDatabases();

    # Get the number of databases $numDbs = $dbList->Count();

    # Iterate through the databases
    for ( $x=0; $x<$numDbs; $x++ )
    {
    $dbObj = $dbList->Item( $x );$dbName = $dbObj->GetName();
    print "DB is $dbName\n";
    }
    CQAdminSession::Unbuild($adminSession);
    ***************************************************************

  3. Run this script as
> cqperl <filename>.pl

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational ClearQuest
API

Software version:

8.0.1

Operating system(s):

Windows

Reference #:

1666302

Modified date:

2014-03-04

Translate my page

Machine Translation

Content navigation