pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: vijayendra mohan agrawal <vijayendra.agrawal@wipro.com>
To: PostGre SQL Mailing List <pgsql-admin@postgresql.org>
Subject: JDBC Driver
Date: Tue, 12 Dec 2000 11:39:09 +0530
Message-ID: <001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com> (raw)

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.Agrawal@wipro.com
**************************************************************




Message-ID: <001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com>
Permalink:  ../001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com/
Also on:    postgresql.org/message-id/001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: vijayendra.agrawal@wipro.com
  Subject: Re: JDBC Driver
  In-Reply-To: <001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com>
  References: <001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox