?
Solved

Connecting to Oracle with DBI using DBD::ODBC

Posted on 2002-06-20
8
Medium Priority
?
828 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 

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 800 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
Six Sigma Control Plans
Suggested Courses

777 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