Building the Right Perl/DBD Document

2002-08-20 Thread WAZA,SANJAY (Non-HP-PaloAlto,ex1)

HI All,
   Please refer to  the attached  document that you might need  for
any future references  to build the right Perl (5.6.1) and DBI/DBD on HP UX
11.0(64 BIT) 
   against Oracle9i .

Thanks
Sanjay



 installperldbdbdi.txt 












After days of Frustration her is the Mantra to make DBD Work on HP UX Platforms


BUILDING THE RIGHT PERL


Here are the Steps that needs to be followed . You should be looged in as root .

1) Download the Perl5.6.1 from CPAN . DO NOT USE THE HP VERSION . IT IS NO GOOD.
2) untar the file . It will create a directory perl5.6.1
3) cd perl5.6.1
4) rm -f config.sh Policy.sh
5) sh Configure  -Dprefix=/opt/perl5.6.1 -Duse64bitint -Duselargefiles -Uusemymalloc 
-Ubincompat5005 -de 

6) Open the config.sh file
7) edit the parameter ccflags  add a +z . It should look exactly like this

   ccflags='+z -D_HPUX_SOURCE +DD64 -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'

8) edit the libs parameter . Make sure it starts with -lcl -lpthread . It should not 
be at the end.
   It should look exactly like this
   
   libs = -lcl -lpthread -lnsl -lnm -ldld -lm -lc -lsec 
   
9) After making these changes to the config.sh run ./configure -de .At one time it may 
prompt you
   that perl found in other locations . Just hit return .
   
10) make test
11) make install 



Next INSTALL the DBI (DBI-1.20 should be downloaded for CPAN)

Before you install DBI .Make sure to check the following

A) The following ENV variables should be set 
$ORACLE_HOME,$ORACLE_SID,$SHLIB_PATH,$PERL5LIB .
B) Check that the listener is running against the version of Oracle against which you 
are planning
   to install DBI/DBD
C) Do a sqlplus to make you that you are able to connect to the Database to make sure
   that the ORACLE_PATH,$PATH Variables etc are set up .

Follow these steps to install DBI . 
1) perl makefile.pl
2) make
3) make test . couple of the tests (I think examp) might fail but it is okay . It will 
build it as 99.8%.
4) make install


Next after Installing DBI install DBD (DBD-Oracle-1.12 should be downloaded from CPAN)

1) perl Makefile.PL
2) make
3) make test
4) make install 

Note: during make test it will try to connect to the database using user scott/tiger 
which might failed
if you don't have this user setup . You may simply ignore this.

Also during make you might get some warning messages like (oci pointer not assigned) 
which you can ignore.



Also Read all the README files pertaining to PERL,DBI,DBD . I had to read all the 
files first before 
you start builing PERL. This is because DBD requires Perl to be configured and build 
with certain settings
which ultimately makes DBD work . So it is a combination of both that I came up to 
successfully build DBI



Next if you have successfully build perl on one machine . You may tar the perl 
directory and untar it 
on other boxes . This way you may not need to do any installations and go through this 
pain .


Thanks

Sanjay


   


DBI Error

2002-08-18 Thread WAZA,SANJAY (Non-HP-PaloAlto,ex1)

I am running this simple script on HP UX 11.0 (64 BIT) . The database is
Oracle 9.2.0

#!/opt/perl5.6.1/bin/perl
use DBI;
print hello\n ;
$dbh = DBI-connect(mydb,scott,tiger,'Oracle') ;


I am getting this error 
install_driver(Oracle) failed: Can't load
'/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBD/Oracle/Oracle.sl'
for module DBD::Oracle: No such file or dire
ctory at /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/DynaLoader.pm line 206.
 at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected


Could somebody help ?

Thanks
Sanjay





RE: DBI Error

2002-08-18 Thread WAZA,SANJAY (Non-HP-PaloAlto,ex1)
/lib/Oraperl.pm
/bin/perl -p -e s/~DRIVER~/Oracle/g 
/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBI/Driver.xst 
Oracle.xsi
/bin/perl -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0
-I/opt/perl5.6.1/lib/5.6.1 /opt/perl5.6.1/lib/5.6.1/ExtUtils/xsubpp
-typemap /opt/perl5.6.1/lib/5.6.1/E
xtUtils/typemap Oracle.xs  Oracle.xsc  mv Oracle.xsc Oracle.c
cc -c -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/public
-I/archive/newdisk/oracle9i/plsql/public -I/archive/newdisk/oracle
9i/network/public -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/demo
-I/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBI -D_HPUX
_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O
-DVERSION=\1.12\  -DXS_VERSION=\1.12\ +z
-I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  Oracle.c
cc -c -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/public
-I/archive/newdisk/oracle9i/plsql/public -I/archive/newdisk/oracle
9i/network/public -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/demo
-I/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBI -D_HPUX
_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O
-DVERSION=\1.12\  -DXS_VERSION=\1.12\ +z
-I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  dbdimp.c
cc -c -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/public
-I/archive/newdisk/oracle9i/plsql/public -I/archive/newdisk/oracle
9i/network/public -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/demo
-I/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBI -D_HPUX
_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O
-DVERSION=\1.12\  -DXS_VERSION=\1.12\ +z
-I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  oci7.c
cc -c -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/public
-I/archive/newdisk/oracle9i/plsql/public -I/archive/newdisk/oracle
9i/network/public -I/archive/newdisk/oracle9i/rdbms/demo
-I/archive/newdisk/oracle9i/rdbms/demo
-I/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBI -D_HPUX
_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O
-DVERSION=\1.12\  -DXS_VERSION=\1.12\ +z
-I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  oci8.c
cc: oci8.c, line 267: warning 604: Pointers are not assignment-compatible.
Running Mkbootstrap for DBD::Oracle ()
chmod 644 Oracle.bs
rm -f blib/arch/auto/DBD/Oracle/Oracle.sl
LD_RUN_PATH=/archive/newdisk/oracle9i/lib ld  -b
+vnocompatwarnings -L/usr/local/lib Oracle.o  dbdimp.o  oci7.o  oci8.o
/archive/newdisk/oracle9i/rdbm
s/lib/defopt.o  -o blib/arch/auto/DBD/Oracle/Oracle.sl
-L/archive/newdisk/oracle9i/lib/ -lclntsh -lcl -lrt -lpthread -ldld -lm
-lqsmashr
ld: /archive/newdisk/oracle9i/rdbms/lib/defopt.o: Mismatched ABI. 64-bit PA
object file found in 32-bit link.
*** Error exit code 1

Stop.

***  If you have problems...
 read all the log printed above, and the README and README.help files.
 (Of course, you have read README by now anyway, haven't you?)


So I did  file /archive/newdisk/oracle9i/rdbms/lib/defopt.o
Here are the results 

/archive/newdisk/oracle9i/rdbms/lib/defopt.o:   ELF-64 relocatable object
file - PA-RISC 2.0 (LP64)

So it is a 64 Bit Object . Does this mean cc is 32 bit ?
I am not sure why i am getting Mismatched ABI. 64-bit PA object file found
in 32-bit link. Or do I need to rebuild Perl with +z flag option ?

Thanks
Much Appreciated your help
Sanjay

-Original Message-
From: Michael A Chase [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 18, 2002 12:20 PM
To: WAZA, SANJAY (Non-HP-PaloAlto, ex1); [EMAIL PROTECTED]
Cc: GANESAN, MAYA (HP-SantaClara, ex4); RAMAN, SETHU (Non-HP-SantaClara,
ex2)
Subject: Re: DBI Error 


On Sun, 18 Aug 2002 13:23:28 -0400 WAZA,SANJAY (Non-HP-PaloAlto,ex1)
[EMAIL PROTECTED] wrote:

 I changed the script as you suggested
 
 #!/opt/perl5.6.1/bin/perl -w
 use strict;
 use DBI;
 my $dbh = DBI-connect( 'dbi:Oracle:p1db',
 'partner1',
 'p1admin',
 {
   RaiseError = 1,
   AutoCommit = 0
 }
   ) || die Database connection not made:
 $DBI::errstr;

If I want a custom error message I normally use { PrintError = 0,
RaiseError = 0, AutoCommit = 0 } and then set $dbh - {RaiseError} to 1
after connect().  Otherwise, connect() never returns on error.  I normally
use something like Can't connect to $sInst as $sUser, $DBI::errstr\n.  It
may not be necessary for you though, since the instance and username have
been added to the RaiseError message in recent versions of DBI.

 The Error is still the same . 
 install_driver(Oracle) failed: Can't load
 '/opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0/auto/DBD/Oracle/Oracle.sl'
 for module DBD::Oracle: No such file or dire
 ctory at /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/DynaLoader.pm line 206.
  at (eval 1) line 3

Oracle 8.0.6 DBI/DBD issue.

2002-07-08 Thread WAZA,SANJAY (Non-HP-PaloAlto,ex1)

Hi,
 I need some help . I have been trying this stuff make work for a couple
of days now. 
The OS is  HP UX 11.0 running perl 5.005_03 . DBI 1.14 and DBD-1.07 for
Oracle .Recently we migrated the Oracle Database from 8.0.5 to 8.0.6
 After migration the DBI and Oraperl scripts stopped working against 8.0.6
.. I ran a simple program

  #!/usr/local/bin/perl
use Oraperl;
printf HELLO\n;
init ;
get_dual ;

sub init
{
   $lda=ora_login('QSTPRD','scott','tiger')|| die $ora_errstr;
}

sub get_dual
{
  $count = select count(*) from dual ;
 $count_csr = ora_open($lda, $count) || die $ora_errstr. \n.$count.\n;
($number) = ora_fetch($count_csr);
  print (The Count is $number\n);
}

The Output I am getting is

HELLO
ORA-01034: ORACLE not available (DBD ERROR: OCISessionBegin) at /tmp/sk line
9.

The Oracle is up and running I am able to connect though  SQLplus .

I have exported the Oracle Home , Instance name etc.


##
#  Setup Oracle Environment Variables
##

ORAENV_ASK=NO; export ORAENV_ASK
ORACLE_HOME=/mnt/disk1/app/oracle/product/8.0.6; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:
export LD_LIBRARY_PATH
ORACLE_SID=QSTPRD ; export ORACLE_SID
ORACLE_ADMIN=/mnt/disk1/app/oracle/admin; export ORACLE_ADMIN
QSTPRD_ADMIN=/mnt/disk1/app/oracle/admin/QSTPRD; export QSTPRD_ADMIN
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33
ORACLE_BASE=/mnt/disk1/app/oracle
#ORACLE_BASE=/home/oracle/app/oracle
APS_BASE=$ORACLE_BASE/local/aps7
#Oracle_path is obsolete
ORACLE_PATH=/home/oracle/sqladmin; export ORACLE_PATH
PATH=$PATH:$ORACLE_HOME/bin:$APS_BASE/bin; export PATH
export APS_BASE ORACLE_PATH PATH
LPDEST=scs4109; export LPDEST
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export SHLIB_PATH=/opt/perl5.005_03/lib:$ORACLE_HOME/lib:/usr/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin


I am not sure why I am getting this error. Also If I point to another
instance of Oracle which is on Oracle 8.0.5 on the same machine the script
runs okay . So only when I point to 8.0.6 I am not able to run it . 

Can you please help on this ?


Thanks

Sanjay