cqperl script on unix

The place to ask a general ClearQuest question
soudane
Posts: 4
Joined: Wed Mar 11, 2015 10:27 am

cqperl script on unix

Postby soudane » Wed Mar 11, 2015 10:38 am

Hello,

I am trying too execute some Perl script on Solaris environment. This script attempt to connect to an Oracle database but it fails!

The same script (using the appropriate perl modules) runs fine on Windows platform.

OI had to set the LD_LIBRARY_PATH variable to /opt/IBM/RationalSDLC/clearquest/sun5/odbc/lib

Here are the libraries I declare inside the script:

use lib "/opt/IBM/RationalSDLC/clearcase/lib/";
use lib "/opt/IBM/RationalSDLC/clearquest/shlib";
use Env;
use CQPerlExt;
use CQCC::CQuest;

I create a session with the following command:

# Establishing a session to CQ
my $SessionObj = CQPerlExt::CQSession_Build() or die "Could not create SESSION object.\n";

Then I successfully retrieve the list of available database:

#Get a list of accessible databases
$databases = $SessionObj->GetAccessibleDatabases("MASTR", "", "")or die "Could not create SESSION object.\n";
$count = $databases->Count();


And when I try to connect to the database, it systematically fails falling in the die function:

for($x=0;$x<$count;$x++){

$db = $databases->Item($x);
$dbName = $db->GetDatabaseName();
print "DBNAME= $dbName\n";
# Logon to the database
$SessionObj->UserLogon("user","passwd","$dbName","FASchema") or die "Could not logon!!!.\n";

#...
}

Any idea?

Thansk for your help

Pavel
Posts: 281
Joined: Fri Dec 12, 2008 12:19 am

Re: cqperl script on unix

Postby Pavel » Thu Mar 12, 2015 11:13 am

Hi,

Have you tried to access the database from Unix using ClearQuest client?
Is your connection on Unix also called "FASchema"?

Pavel

soudane
Posts: 4
Joined: Wed Mar 11, 2015 10:27 am

Re: cqperl script on unix

Postby soudane » Mon Mar 16, 2015 3:16 am

Hello,

The connection to the database is working fine from the native client. All queries are running without problem..

The conection is alos named "FASchema" (the same db for tboth environment Windows and UX).

Thanks for your support.

Etienne

Pavel
Posts: 281
Joined: Fri Dec 12, 2008 12:19 am

Re: cqperl script on unix

Postby Pavel » Mon Mar 16, 2015 3:04 pm

When everything configured correctly, it should work without "use lib" statements.
It might be that some environment variables cause this issue. Could you check is any Perl-related environment variables are set? For instance, PERL5LIB?
What is an output of "cqperl -V"?

Pavel

soudane
Posts: 4
Joined: Wed Mar 11, 2015 10:27 am

Re: cqperl script on unix

Postby soudane » Tue Mar 17, 2015 3:13 am

> cqperl -V

Your environment has already defined CQ_HOME to be /opt/rational/clearquest.
Removing all references to /opt/rational/clearquest from the
environment variables PATH and LD_LIBRARY_PATH.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
Platform:
osname=solaris, osvers=2.9, archname=sun4-solaris-multi
uname='sunos radon 5.9 generic_118558-30 sun4u sparc sunw,sun-fire-v440 '
config_args='-d -e -O -D cc=cc -D prefix=/opt/rational/common -D perl=ratlperl -D startperl=: -D perlpath=ratlperl -D usemultiplicity -U use5005threads -D usedl -D useshrplib -U usemymalloc -D cf_by=ibm -D cf_email=sw_support@us.ibm.com -D perladmin=sw_support@us.ibm.com -D uselargefiles -D usethreads -D useithreads -D use64bitint -D make=clearmake -OvV -D ldcc=CC -D optimize=-xO4 -fns -fsingle -fsimple=2 -ftrap=%none -xmemalign=8s -xtarget=generic -xbuiltin=%all -xdepend -xlibmil -xlibmopt -xunroll=3 -D libpth=/vobs/sys/SOLARIS/sun5.8/usr/lib -D locincpth=/vobs/sys/SOLARIS/sun5.8/usr/include -U loclibpth= -D lddlflags=-G -L$(PERL_INC) -lratlperl -mt -L/vobs/sys/SOLARIS/sun5.8/usr/lib -norunpath -R/opt/rational/common/shlib -i -xmemalign=8s -Bdynamic -D ldflags=-mt -L/vobs/sys/SOLARIS/sun5.8/usr/lib -norunpath -R/opt/rational/common/shlib -i -xmemalign=8s -Bdynamic -D ccdlflags=-Bdynamic -D dlsrc=dl_dlopen.xs -D ldlibpthname=LD_LIBRARY_PATH -D cccdlflags=-xcode=pic32 -D ccflags=-mt -DPERL_IMPLICIT_CONTEXT -DPERL_USE_SAFE_PUTENV -Xa -xtransition -errfmt -xstrconst -mr -Qn -v -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED,E_STATEMENT_NOT_REACHED,E_SLASH_STAR_IN_CMNT -D libperl=libratlperl.so -D so=so'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -mt -DPERL_IMPLICIT_CONTEXT -DPERL_USE_SAFE_PUTENV -Xa -xtransition -errfmt -xstrconst -mr -Qn -v -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED,E_STATEMENT_NOT_REACHED,E_SLASH_STAR_IN_CMNT -I/vobs/sys/SOLARIS/sun5.8/usr/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-xO4 -fns -fsingle -fsimple=2 -ftrap=%none -xmemalign=8s -xtarget=generic -xbuiltin=%all -xdepend -xlibmil -xlibmopt -xunroll=3',
cppflags='-D_REENTRANT -mt -DPERL_IMPLICIT_CONTEXT -DPERL_USE_SAFE_PUTENV -Xa -xtransition -errfmt -xstrconst -mr -Qn -v -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED,E_STATEMENT_NOT_REACHED,E_SLASH_STAR_IN_CMNT -I/vobs/sys/SOLARIS/sun5.8/usr/include'
ccversion='Sun C 5.6 Patch 117551-04 2005/02/15', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-mt -mt -L/vobs/sys/SOLARIS/sun5.8/usr/lib -norunpath -R/opt/rational/common/shlib -i -xmemalign=8s -Bdynamic '
libpth=/vobs/sys/SOLARIS/sun5.8/usr/lib
libs=-lsocket -lnsl -ldl -lm -lpthread -lc
perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libratlperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Bdynamic -R /opt/rational/common/lib/perl5/5.8.6/sun4-solaris-multi/CORE'
cccdlflags='-xcode=pic32', lddlflags='-mt -G -L$(PERL_INC) -lratlperl -mt -L/vobs/sys/SOLARIS/sun5.8/usr/lib -norunpath -R/opt/rational/common/shlib -i -xmemalign=8s -Bdynamic'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under solaris
Compiled at Jun 9 2011 00:42:43
@INC:
/dswpool/rational/IBM/RationalSDLC/clearquest/sun5/shlib
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/5.8.6/sun4-solaris-multi
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/5.8.6/sun4-solaris-multi
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/5.8.6
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl/5.8.6/sun4-solaris-multi
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl/5.8.6/sun4-solaris-multi
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl/5.8.6
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl/5.8.6/sun4-solaris-multi
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl/5.8.6
/dswpool/rational/IBM/RationalSDLC/clearquest/../common/lib/perl5/site_perl
.
> echo $PERL5LIB
PERL5LIB: Undefined variable
>
> echo $LD_LIBRARY_PATH
/opt/IBM/RationalSDLC/clearquest/sun5/odbc/lib
>

Pavel
Posts: 281
Joined: Fri Dec 12, 2008 12:19 am

Re: cqperl script on unix

Postby Pavel » Tue Mar 17, 2015 11:42 am

Hi,

I don't think that testing UserLogon return value is a correct approach. This method suppose to throw an exception in case of failure. I would start with removing "or die" statement and wrap the code in the eval block.

Pavel

soudane
Posts: 4
Joined: Wed Mar 11, 2015 10:27 am

Re: cqperl script on unix

Postby soudane » Wed Mar 18, 2015 6:46 am

Hello,

You are rigth! The connection to the db works fine if I remove de "or die"!!

Thanks for your help!


Return to “General ClearQuest Questions”

Who is online

Users browsing this forum: No registered users and 3 guests

cron