CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
connecting to oracle with perl

 



caesarkim
Novice

Feb 18, 2003, 10:13 AM

Post #1 of 9 (1421 views)
connecting to oracle with perl Can't Post

Unsureplease tell me how to connect to oracle 8i with perl.

i have read a little about it, but i don't understand. people say that i have to download modules from CPAN. but i don't know what to download and what to do.

please tell me step by step...



This is my code to use ODBC.pm module, but it failed. don't know why...

#!/usr/bin/perl


use Win32::ODBC;


if (!($O = new Win32::ODBC("DSN=rocky;UID=scott;PWD=tiger"))){
print "Failure. \n\n";
$Failed{'Test 3a'} = "new(): " . Win32::ODBC::Error();
exit();
}else{
print "Success (connection #", $O->Connection(), ")\n\n";
}


Thanks in advance...


davorg
Thaumaturge / Moderator

Feb 19, 2003, 1:22 AM

Post #2 of 9 (1414 views)
Re: [caesarkim] connecting to oracle with perl [In reply to] Can't Post

You need to download and install DBI and DBD::Oracle. Don't use ODBC.

If you're using ActivePerl on Windows (which I'm guessing from your reference to ODBC in your example code) then you can probably install the modules using "ppm".

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


(This post was edited by davorg on Feb 19, 2003, 6:27 AM)


caesarkim
Novice

Feb 19, 2003, 6:06 AM

Post #3 of 9 (1411 views)
Re: [davorg] connecting to oracle with perl [In reply to] Can't Post

where can i download "DBI" or DBI::Oracle?


davorg
Thaumaturge / Moderator

Feb 19, 2003, 6:15 AM

Post #4 of 9 (1410 views)
Re: [caesarkim] connecting to oracle with perl [In reply to] Can't Post


In Reply To
where can i download "DBI" or DBI::Oracle?


My previous post contained links. Did you try following them?

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


caesarkim
Novice

Feb 19, 2003, 6:17 AM

Post #5 of 9 (1408 views)
Re: [davorg] connecting to oracle with perl [In reply to] Can't Post

but the link for DBD::Oracle is broken...

anyway, after i download it, where should i put it? and is there anything else that i have to set up?



Thanks for your info..


davorg
Thaumaturge / Moderator

Feb 19, 2003, 6:32 AM

Post #6 of 9 (1405 views)
Re: [caesarkim] connecting to oracle with perl [In reply to] Can't Post


In Reply To
but the link for DBD::Oracle is broken...


Oops. Sorry. Fixed it now.


In Reply To
anyway, after i download it, where should i put it? and is there anything else that i have to set up?


There's a standard way to install Perl modules. It's described in the README file. There are more details in the perlmodinstall manual page that comes with Perl.

And as I said before, if you're using ActivePerl on Windows then you'll probably be better off using ppm to install the modules.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


caesarkim
Novice

Feb 19, 2003, 7:15 AM

Post #7 of 9 (1404 views)
Re: [davorg] connecting to oracle with perl [In reply to] Can't Post

sorry for keeping bothering you... but i want to make it work...

this is my test code..

#!/usr/bin/perl


use DBI;
use strict;

my $dbh;
$dbh = DBI->connect("DBI:Oracle:mydb", "scott", "tiger", { RaiseError => 1, AutoCommit => 0 });

i am running on windows 2000 server, but it says

"install_driver(oracle) failed: Can't locate DBD/oracle.pm in @INC (@INC contains: C:/Perl/lib C:/Per
3.
Perhaps the DBD::oracle perl module hasn't been fully installed,
or perhaps the capitalisation of 'oracle' isn't right.
Available drivers: ExampleP, Proxy."..

i don't know what that means... please tell me what to do. when i was trying to install DBD::Oracle, it failed. i can't install it. i typed like this "perl Makefile.pl" after i unzipped the DBD_Oracle.zip in a new directory.



thanks again...


davorg
Thaumaturge / Moderator

Feb 19, 2003, 7:38 AM

Post #8 of 9 (1403 views)
Re: [caesarkim] connecting to oracle with perl [In reply to] Can't Post

So you're saying that

In Reply To
when i was trying to install DBD::Oracle, it failed.

But you went on and tried to use it anyway.

Then when you used it you got an error that included the phrase

In Reply To
Perhaps the DBD::oracle perl module hasn't been fully installed


Perhaps that might be because you haven't installed the module. Rather than pressing on and running a test script that can't possibly work, you might have been better advised to investigate the errors you got when installing DBD::Oracle.

I assume you realise that any machine that talks to an Oracle database will need the Oracle client libraries installed.

And I'll tell you for the third time (so it must be true!) that if you're on Windows thne you'll find it much easier to use ppm to install CPAN modules.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


caesarkim
Novice

Feb 19, 2003, 7:52 AM

Post #9 of 9 (1396 views)
Re: [davorg] connecting to oracle with perl [In reply to] Can't Post

i used ppm to install CPAN modules already. i installed DBI and CPAN. but when i tried to install DBD::Oracle, it says " it can't find that module in CPAN".

that's the current situation that can't talk to the oracle.

is there any more module that i have to install?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives