Solved

Connecting to Oracle with DBI using DBD::ODBC

Posted on 2002-06-20
8
787 Views
Last Modified: 2008-03-17
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
Comment
Question by:bjburke
  • 5
  • 2
8 Comments
 
LVL 1

Expert Comment

by:BigJoe1008
ID: 7096403
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
 

Author Comment

by:bjburke
ID: 7096527
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
 
LVL 1

Expert Comment

by:BigJoe1008
ID: 7096846
Did you install the Oracle client?  If so make sure you installed the Pro-C and SQLplus
0
 
LVL 1

Expert Comment

by:BigJoe1008
ID: 7096922
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:bjburke
ID: 7097048
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
 
LVL 1

Accepted Solution

by:
BigJoe1008 earned 200 total points
ID: 7097368
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
 
LVL 1

Expert Comment

by:BigJoe1008
ID: 7097371
Oracle should have a free download.

0
 
LVL 8

Expert Comment

by:inq123
ID: 9512553
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now