
lost_in_perl
New User
Sep 15, 2006, 3:33 AM
Post #1 of 2
(5199 views)
|
Connecting to Oracle using JDBC
|
Can't Post
|
|
Hi Guys, Complete noob here so bare with me. Looking to write a simple script to connect to our Oracle database using JDBC drivers. Can you tell me if my syntax is correct here please? #! /usr/bin/perl -w use DBI; my $url = 'jdbc:oracle:thin:@buku:1521:tst01'; my $user = "test"; my $password = "test2717"; my $dbh = DBI->connect("dbi:JDBC:hostname=$hostname;port=$port;url=$url", $user, $password) or die("failed to connect: $DBI::errstr"); I have my JDBC driver on the classpath and can connect using the same URL from a simple Java application so I know it works. I get the following when I run my script.
DBI connect('hostname=buku;port=1521;url=jdbc:oracle:thin:@buku:1521:tst01','jira',...) failed: I/O Error at /usr/local/bin/db_connect.pl line 12 failed to connect: I/O Error at /usr/local/bin/db_connect.pl line 12. Thanks guys.
(This post was edited by lost_in_perl on Sep 15, 2006, 6:37 AM)
|