Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any idea on how to connect to Oracle with Perl?

Status
Not open for further replies.

jablonsky

Programmer
Jul 31, 2007
3
CA
hi all,
I already posted this to the Perl group but nobody had any idea ... :-(
My question is how to connect to Oracle 10g with Perl.

my perl installation is: Perl 5.8.6.811 and I have installed DBI 1.58 and DBD-Oracle 1.17

I have installed Oracle 10g Client 10.2.0 and I am trying to access a 10g 10.2 server.

Right now I am getting a strange message when I try to execute this code:
#############################
#!/usr/bin/perl
use strict;

use DBI;

print "before connection!\n";

my $usr = "user";
my $pwd = "pass";

my $dbh = DBI->connect("dbi:Oracle:eek:rcl_192.168.55.116", $usr, $pwd) || die "DB connection not established: $DBI::errstr";

print "after connection!\n";

##################################
I checked the connection - I can connect with all mgmgt tools from my location, with SQL*Plus, the service is orcl_192.168.55.116 , user is correct, password is correct.

The first error is:
The procedure entry point Perl_Glockhook_ptr could not be located in the dynamic link library perl58.dll
After I click the OK button in this error window the message in my DOS window is:
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file: The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 230 at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected at C:\perl_dev\oracle\con1.pl line 10
and then it prints before connection!

I know there should be an alternative ODBC connection, nevertheless I would like to see if I can fix this first.
Anybody any idea?

Thanks,
jablonsky
 
Hi,

Have you been able to fix this problem yet? I am facing the same problem with a small CGI (Perl) prgoram that I am trying to run on Tomcat (with CGI support enabled).

This is the error message I am getting:

install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at C:/Perl/lib/DynaLoader.pm line 229.
at (eval 7) line 3
 
Try getting more explicit.

DBI->connect("DBI:Oracle:host=$g_HOST;sid=$g_SID"
where g_HOST and g_SID are the host and sid in the alias orcl_192.168.55.116.

Perl may not like the tnsnames alias orcl_192.168.55.116 which is not a sid, so I think the module is choking on it's periods. I believe it uses the oracle client code, but not necessarily the tnsnames translations. That's possibly why you can connect with sqlplus, but perl pukes.
 
Hi Jablonsky.

Doesn't the DBI modle use single quote:
DBI->connect('dbi:Oracle:eek:rcl_192.168.55.116', '$usr', '$pwd')

Instead of double as you have written?

The DBI pases the strings and queries to the DBD which looks for properly formatted data.



Good Luck
DrD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top