Solved

Connecting to Oracle with DBI using DBD::ODBC

Posted on 2002-06-20
8
803 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
grep that displays 4 lines above & 1 line below of what's found 10 81
Question about @INC variable in perl 1 58
perl to convert excel to csv 3 210
Export Variables in Perl 3 68
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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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