Lou1
asked on
problems installing DBI and DBD:Oracle modules
ok, this is the problem i am having. i am trying to run Perl on Windows, so i installed ActiveState Perl. so i ran a small Hello World program and it worked fine. But then i needed to pull data from an Oracle database, so installed the DBI and DBD:Oracle modules from the CPAN site. i followed the instructions in the README files, but i must have done something wrong because i am the getting the foloowing error in a small Perl program for accessing an Oracle db:
can't locate object method "connect" via package "DBI"
and here is the source of the program:
#!/usr/bin/perl
use lib "/DBI/DBI-1.45/DBI";
#database connection variables;
my $dbname = "dbname";
my $user = "username";
my $password = "password";
#connection string for the database, change this with change of db;
$connect_string = "dbi:Oracle:$dbname";
#the actual connection string for the database;
$dbh = DBI->connect($connect_stri ng, "$user", "$password")
or die "Could not open database: " . $DBI::errstr;
#disconnecting the database handle;
$dbh->disconnect
or print ERROR "Error disconnecting: $DBI::errstr";
print "end program\n";
exit;
On line 2 i have 'use lib "/DBI/DBI-1.45/DBI"' instead of 'use DBI' because that's the directory i installed DBI in.
any ideas what the problem could be?
Thanks.
can't locate object method "connect" via package "DBI"
and here is the source of the program:
#!/usr/bin/perl
use lib "/DBI/DBI-1.45/DBI";
#database connection variables;
my $dbname = "dbname";
my $user = "username";
my $password = "password";
#connection string for the database, change this with change of db;
$connect_string = "dbi:Oracle:$dbname";
#the actual connection string for the database;
$dbh = DBI->connect($connect_stri
or die "Could not open database: " . $DBI::errstr;
#disconnecting the database handle;
$dbh->disconnect
or print ERROR "Error disconnecting: $DBI::errstr";
print "end program\n";
exit;
On line 2 i have 'use lib "/DBI/DBI-1.45/DBI"' instead of 'use DBI' because that's the directory i installed DBI in.
any ideas what the problem could be?
Thanks.
Try this
require <path to DBI>/DBI.pm
eg. require /DBI/DBI-1.45/DBI.pm
-= Felix =-
require <path to DBI>/DBI.pm
eg. require /DBI/DBI-1.45/DBI.pm
-= Felix =-
you still need to "use DBI"; since "use lib ..." only adds that directory to the search path where perl looks for modules.
ASKER
ok, now i did this:
.......................... .......... .....
use lib "c:/Perl/lib/DBI/DBI-1.45" ;
use DBI;
#database connection variables;
my $dbname = "dbname";
my $user = "username";
my $password = "password";............... .......... ........
.......................... .......... .......... ......
and i am getting the following error:
can't locate loadable object for module DBI in @INC(@INC contains: c:/Perl/lib/DBI/DBI-1.45 c:/Perl/lib c:/Perl/site/lib .) at c:/Perl/lib/DBI/DBI-1.45/D BI.pm line 254
where line 254 is:
Exporter::export_ok_tags(k eys %EXPORT_TAGS);
..........................
use lib "c:/Perl/lib/DBI/DBI-1.45"
use DBI;
#database connection variables;
my $dbname = "dbname";
my $user = "username";
my $password = "password";...............
..........................
and i am getting the following error:
can't locate loadable object for module DBI in @INC(@INC contains: c:/Perl/lib/DBI/DBI-1.45 c:/Perl/lib c:/Perl/site/lib .) at c:/Perl/lib/DBI/DBI-1.45/D
where line 254 is:
Exporter::export_ok_tags(k
you need to install the module properly. It should not have gone in a separate directory like that. It can't find the other parts that come with the installation, which should have gone into the lib/auto/DBI directory.
I'd suggest you rerun the installation, and this time just install the binary package with ppm. A simple "ppm install DBI" will do the trick for you.
I'd suggest you rerun the installation, and this time just install the binary package with ppm. A simple "ppm install DBI" will do the trick for you.
ASKER
ok, so what's PPM? i launched CygWin and typed "ppm" but it said "command not found". i am running my Perl through CygWin, i.e. i am on a Windows XP machine so what i did was this:
1. i installed CygWin and when i launcg it i am in directory "C:\Documents and Settings\myusername"
2. i installed ActiveState Perl. i think that went in "C:\Perl"
3. i installed DBI 1.45 in directory "C:\Documents and Settings\myusername\cygwin ", i.e. i unpacked the module files and extracted them in that directory and then did:
perl makefile.pl
make
make test
make install
4. i installed DBD Oracle in the same directory, i.e. i unpacked the module files and extracted them in "C:\Documents and Settings\myusername\cygwin \DBI-1.45" and did:
perl makefile.pl
make
make test
make install
i don't remember if i got any errors while doing 3 and 4.
1. i installed CygWin and when i launcg it i am in directory "C:\Documents and Settings\myusername"
2. i installed ActiveState Perl. i think that went in "C:\Perl"
3. i installed DBI 1.45 in directory "C:\Documents and Settings\myusername\cygwin
perl makefile.pl
make
make test
make install
4. i installed DBD Oracle in the same directory, i.e. i unpacked the module files and extracted them in "C:\Documents and Settings\myusername\cygwin
perl makefile.pl
make
make test
make install
i don't remember if i got any errors while doing 3 and 4.
ASKER
ok, i think i installed DBI successfully, now i am struggling with DBD:Oracle. i am getting some kind of error. here is my listing:
$ perl makefile.pl
Using DBI 1.45 (for perl 5.008005 on cygwin-thread-multi-64int) installed in /us
r/lib/perl5/site_perl/5.8. 5/cygwin-t hread-mult i-64int/au to/DBI/
Configuring DBD::Oracle ...
>>> Remember to actually *READ* the README file!
Especially if you have any problems.
Using Oracle in /cygdrive/C/Oracle/Ora81
I'm having trouble finding your Oracle version number... trying harder
Oracle version 8.1.0 (8.1)
Found oci directory
Using OCI directory 'oci'
Checking for functioning wait.ph
System: perl5.008005 cygwin_nt-5.1 inspiron 1.5.10(0.11642) 2004-05-25 22:07 i68
6 unknown unknown cygwin
Compiler: gcc -O2 -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/loc
al/include
Linker: /usr/bin/ld
Sysliblist:
Warning: If you have problems you may need to rebuild perl with -Uusemymalloc.
LD_RUN_PATH=/cygdrive/C/Or acle/Ora81 /lib:/cygd rive/C/Ora cle/Ora81/ rdbms/lib
Using DBD::Oracle 1.16.
Using DBD::Oracle 1.16.
Using DBI 1.45 (for perl 5.008005 on cygwin-thread-multi-64int) installed in /us
r/lib/perl5/site_perl/5.8. 5/cygwin-t hread-mult i-64int/au to/DBI/
Writing Makefile for DBD::Oracle
*** 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?)
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per l5/site_pe rl/5.8.5/c ygwin-thre ad-
multi-64int/DBD
$ make
Skip blib/lib/DBD/Oracle.pm (unchanged)
Skip blib/lib/DBD/DBM.pm (unchanged)
Skip blib/lib/DBD/test1.pl (unchanged)
Skip blib/lib/DBD/Sponge.pm (unchanged)
Skip blib/lib/oraperl.ph (unchanged)
Skip blib/arch/auto/DBD/Oracle/ dbdimp.h (unchanged)
Skip blib/lib/DBD/Proxy.pm (unchanged)
Skip blib/arch/auto/DBD/Oracle/ ocitrace.h (unchanged)
Skip blib/lib/Oraperl.pm (unchanged)
Skip blib/lib/DBD/File.pm (unchanged)
Skip blib/arch/auto/DBD/Oracle/ Oracle.h (unchanged)
Skip blib/lib/DBD/NullP.pm (unchanged)
Skip blib/lib/DBD/ExampleP.pm (unchanged)
Skip blib/lib/DBD/Oracle/GetInf o.pm (unchanged)
cp mk.pm blib/arch/auto/DBD/Oracle/ mk.pm
gcc -c -I/cygdrive/C/Oracle/Ora81 /oci/inclu de -I/cygdrive/C/Oracle/Ora81 /rdbms/
demo -I/usr/lib/perl5/site_perl /5.8.5/cyg win-thread -multi-64i nt/auto/DB I/ -DPERL
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy gwin-t
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" Oracle.c
gcc -c -I/cygdrive/C/Oracle/Ora81 /oci/inclu de -I/cygdrive/C/Oracle/Ora81 /rdbms/
demo -I/usr/lib/perl5/site_perl /5.8.5/cyg win-thread -multi-64i nt/auto/DB I/ -DPERL
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy gwin-t
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per l5/site_pe rl/5.8.5/c ygwin-thre ad-
multi-64int/DBD
$ make test
gcc -c -I/cygdrive/C/Oracle/Ora81 /oci/inclu de -I/cygdrive/C/Oracle/Ora81 /rdbms/
demo -I/usr/lib/perl5/site_perl /5.8.5/cyg win-thread -multi-64i nt/auto/DB I/ -DPERL
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy gwin-t
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per l5/site_pe rl/5.8.5/c ygwin-thre ad-
multi-64int/DBD
$ make install
gcc -c -I/cygdrive/C/Oracle/Ora81 /oci/inclu de -I/cygdrive/C/Oracle/Ora81 /rdbms/
demo -I/usr/lib/perl5/site_perl /5.8.5/cyg win-thread -multi-64i nt/auto/DB I/ -DPERL
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy gwin-t
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per l5/site_pe rl/5.8.5/c ygwin-thre ad-
multi-64int/DBD
$ perl -MDBD::Oracle -e 0
Can't load '/cygdrive/c/Oracle/Ora81/ bin/Oracle ' for module DBD::Oracle: dlopen,
Win32 error 126 at /usr/lib/perl5/5.8.5/cygwi n-thread-m ulti-64int /DynaLoade r.pm
line 230.
at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.
$ perl makefile.pl
Using DBI 1.45 (for perl 5.008005 on cygwin-thread-multi-64int)
r/lib/perl5/site_perl/5.8.
Configuring DBD::Oracle ...
>>> Remember to actually *READ* the README file!
Especially if you have any problems.
Using Oracle in /cygdrive/C/Oracle/Ora81
I'm having trouble finding your Oracle version number... trying harder
Oracle version 8.1.0 (8.1)
Found oci directory
Using OCI directory 'oci'
Checking for functioning wait.ph
System: perl5.008005 cygwin_nt-5.1 inspiron 1.5.10(0.11642) 2004-05-25 22:07 i68
6 unknown unknown cygwin
Compiler: gcc -O2 -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/loc
al/include
Linker: /usr/bin/ld
Sysliblist:
Warning: If you have problems you may need to rebuild perl with -Uusemymalloc.
LD_RUN_PATH=/cygdrive/C/Or
Using DBD::Oracle 1.16.
Using DBD::Oracle 1.16.
Using DBI 1.45 (for perl 5.008005 on cygwin-thread-multi-64int)
r/lib/perl5/site_perl/5.8.
Writing Makefile for DBD::Oracle
*** 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?)
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per
multi-64int/DBD
$ make
Skip blib/lib/DBD/Oracle.pm (unchanged)
Skip blib/lib/DBD/DBM.pm (unchanged)
Skip blib/lib/DBD/test1.pl (unchanged)
Skip blib/lib/DBD/Sponge.pm (unchanged)
Skip blib/lib/oraperl.ph (unchanged)
Skip blib/arch/auto/DBD/Oracle/
Skip blib/lib/DBD/Proxy.pm (unchanged)
Skip blib/arch/auto/DBD/Oracle/
Skip blib/lib/Oraperl.pm (unchanged)
Skip blib/lib/DBD/File.pm (unchanged)
Skip blib/arch/auto/DBD/Oracle/
Skip blib/lib/DBD/NullP.pm (unchanged)
Skip blib/lib/DBD/ExampleP.pm (unchanged)
Skip blib/lib/DBD/Oracle/GetInf
cp mk.pm blib/arch/auto/DBD/Oracle/
gcc -c -I/cygdrive/C/Oracle/Ora81
demo -I/usr/lib/perl5/site_perl
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" Oracle.c
gcc -c -I/cygdrive/C/Oracle/Ora81
demo -I/usr/lib/perl5/site_perl
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per
multi-64int/DBD
$ make test
gcc -c -I/cygdrive/C/Oracle/Ora81
demo -I/usr/lib/perl5/site_perl
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per
multi-64int/DBD
$ make install
gcc -c -I/cygdrive/C/Oracle/Ora81
demo -I/usr/lib/perl5/site_perl
_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB
-O2 -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-I/usr/lib/perl5/5.8.5/cy
hread-multi-64int/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8
.1.0\" dbdimp.c
dbdimp.c:19:20: stdafx.h: No such file or directory
dbdimp.c: In function `ora_db_login6':
dbdimp.c:283: warning: unused variable `o'
dbdimp.c:284: warning: unused variable `l'
dbdimp.c:315: warning: cast to pointer from integer of different size
dbdimp.c:329: warning: cast to pointer from integer of different size
dbdimp.c:339: warning: cast to pointer from integer of different size
dbdimp.c:343: warning: cast to pointer from integer of different size
dbdimp.c:386: warning: unused variable `rsize'
dbdimp.c: In function `dbd_rebind_ph_char':
dbdimp.c:1121: warning: cast from pointer to integer of different size
make: *** [dbdimp.o] Error 1
lvassilev@CM12228989 /cygdrive/c/cygwin/lib/per
multi-64int/DBD
$ perl -MDBD::Oracle -e 0
Can't load '/cygdrive/c/Oracle/Ora81/
Win32 error 126 at /usr/lib/perl5/5.8.5/cygwi
line 230.
at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
kandura,
i guess i forgot to mention this but i already uninstalled ActiveState Perl. so it's just cygwin now.
i guess i forgot to mention this but i already uninstalled ActiveState Perl. so it's just cygwin now.
ASKER