JDBC Driver

From: "vijayendra mohan agrawal" <vijayendra(dot)agrawal(at)wipro(dot)com>
To: "PostGre SQL Mailing List" <pgsql-admin(at)postgresql(dot)org>
Subject: JDBC Driver
Date: 2000-12-12 06:09:09
Message-ID: 001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi all,

I want to use PostGreSQL in my Java application. I have compiled jdbc2 since
I am using JDK1.2
I have placed the jar file in my CLASSPATH. I am trying to connect to
PostGreSQL server running in HP-UX machine connected to my PC through LAN.
In my machine, I am working in Windows 95 platform.

The following piece of code depicts, how I am trying to connect to the
server. But it returns false for acceptsURL() call itself and throws
SQLException.

In the HP-UX machine, where I am running PostGreSQL server, I didn't see
port 5432 in /etc/services. Shall I add one entry with this port number
here. What else might be required ?

try
{
Class.forName("org.postgresql.Driver");
org.postgresql.Driver dr = new org.postgresql.Driver();
System.out.println("driver accepts URL :" +
dr.acceptsURL("jdbc:org.postgresql://192.168.20.19:5432/avijaynesimdb"));
System.out.println("Connecting to "+url);
con = DriverManager.getConnection(url,usr,pwd);
System.out.println("Connected "+con);
st = con.createStatement();
}
catch(ClassNotFoundException cnfe)
{
System.out.println("Could not find JDBC driver. Please check the CLASSPATH.
" +
cnfe.getMessage());
}
catch(SQLException sqle)
{
System.out.println("Could not connect to database. " +
"Please check whether the database server is running or not. " +
sqle.getMessage());
}

Thank You,
Best Regards,
Vijay

************************************************************
Vijayendra Mohan Agrawal
Wipro Technologies
26, Hosur Main Road, Bommanhalli,
Bangalore-560068, India
Tel: 91-80-5722296 Extn:3076
Fax: 91-80-5722696
E-mail : Vijayendra(dot)Agrawal(at)wipro(dot)com
**************************************************************

Browse pgsql-admin by date

  From Date Subject
Next Message Dronamraju Rajesh 2000-12-12 06:28:38 Re: [BUGS] LockReplace: xid table corrupted
Previous Message Tom Lane 2000-12-12 06:08:14 Re: [BUGS] LockReplace: xid table corrupted