[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

Connecting to Oracle with DBI using DBD::ODBC

I set up a system dsn on windows 2000 called Module_Ack.  I am trying to connect via ODBC to an Oracle 8i database that is on another server on the network.  My connect statement is the following:

use DBI;
$dbh = DBI->connect('dbi:ODBC:Module_Ack', 'username', 'password');

When I run the script I get the following error.

connect(Module_Ack) failed: Specified driver could not be loaded due to system error 126 (Oracle73 Ver 2.5). (SQL-IM003)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\testrisk\cgi-bin\CompModuleAck.pl line 372 ="0">

CompModuleAck.pl line 372 is the line of the connect statement above.  Any Ideas?

Thanks,

Brian
0
bjburke
Asked:
bjburke
  • 5
  • 2
1 Solution
 
BigJoe1008Commented:
If you are using Activestate perl just use DBD::Oracle.  It is very simple to do.

You may need to use the Oracle 8.1.7 driver for windows (By Oracle) Microsofts driver has issues sometimes.

Try to connect in the DSN manager tool.  Make sure that works.  
0
 
bjburkeAuthor Commented:
I tried using DBD::Oracle but I get this error:

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 206.

I looked in the path C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll and the Oracle.dll file is there, so I don't know why it can't load it.

I'm using the following code to connect.

use DBI;
use DBD:Oracle;

$ENV{'ORACLE_HOME'} =   'C:\ORANT\BIN';

$dbh = DBI->connect('dbi:Oracle:dms_d', 'username', 'password')

dms_d is the alias that is in my tnsnames.ora file.
0
 
BigJoe1008Commented:
Did you install the Oracle client?  If so make sure you installed the Pro-C and SQLplus
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
BigJoe1008Commented:
Here is an example of how I connect to ODBC declared dbs on Winnt

#!/usr/bin/perl
use DBI;

my $dbh = DBI->connect("DBI:ADO:products")or die "Connecting : $DBI::errstr\n";

Here is for straight oracle.

#!/usr/bin/perl
use DBI;

my $dbh = DBI->connect("DBI:Oracle:host=bigserver;sid=database", 'username', 'password') or die "Connecting : $DBI::errstr\n";


Make sure you have Oracle 8+ client installed.  It may be an issue if you are running Oracle 7.X
0
 
bjburkeAuthor Commented:
I have the Oracle client and SQLplus installed.  I'm not sure what Pro-C is, but I don't have that installed.  Maybe the problem is I'm running Oracle client 7.X

I'll have to see if I can get my hands on 8+ client.  

It doesn't make sense that Perl can't load the Oracle.dll file even though the file exists in that directory.


0
 
BigJoe1008Commented:
From this error:
connect(Module_Ack) failed: Specified driver could not be loaded due to system error 126 (Oracle73 Ver
2.5). (SQL-IM003)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\testrisk\cgi-bin\CompModuleAck.pl
line 372 ="0">

it shows it is trying to access something that is in the Oracle 8 client that isn't in 7.

0
 
BigJoe1008Commented:
Oracle should have a free download.

0
 
inq123Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept a comment by BigJoe1008

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

inq123
EE Cleanup Volunteer
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now