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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI: Connecting to Oracle using JDBC: Edit Log

New User

Sep 15, 2006, 3:33 AM

Views: 5921
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?

 #! /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/ line 12 
failed to connect: I/O Error at /usr/local/bin/ 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