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: DBI: Connecting to Oracle using JDBC: Edit Log



lost_in_perl
New User

Sep 15, 2006, 3:33 AM


Views: 2837
Connecting to Oracle using JDBC

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?


Code
 #! /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.


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


Edit Log:
Post edited by lost_in_perl (New User) on Sep 15, 2006, 3:57 AM
Post edited by lost_in_perl (New User) on Sep 15, 2006, 6:37 AM


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

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