pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mamoon Rashid <mamoon@imtech.res.in>
To: pgsql-jdbc@postgresql.org
Subject: Failed to load jdbc driver
Date: Thu, 7 Jun 2007 13:51:54 +0530 (IST)
Message-ID: <46984.59.160.112.41.1181204514.squirrel@imtech.res.in> (raw)

hi all,
background Info-
1.OS: EL4 linux
2. postgresql 8.2.4
3. postgresql-8.2-505.jdbc4.jar
4. JDK1.6
5. Apache2.0.59
6. PHP as cgi processor
When i try to execute my JDBC program through browser the error in the
httpd error_log file look like-
[Thu Jun 07 13:28:35 2007] [error] [client 127.0.0.1] Failed to load
driver., referer: http://127.0.0.1/search.html
[Thu Jun 07 13:28:35 2007] [error] [client 127.0.0.1] , referer:
http://127.0.0.1/search.html

Although i am able to execute this from terminal.The following are the
syntax to load the driver and connect to the database server in JDBC
progm-
	String sDriver = "org.postgresql.Driver";
	String sURL = "jdbc:postgresql://127.0.0.1:5432/infodb";
               //instead of 127.0.0.1 , [::1] also works
	String sUSER = "nobody";//user of the database
	String sPASSWD = "";

	try //try to load the jdbc driver
	    {
		Class.forName ("org.postgresql.Driver");
	    }
	catch (Exception e)//error
	    {
		System.err.println("Failed to load driver.");
		return;
	    }//end catch

	try //try to connect to database server
	    {
		con = DriverManager.getConnection (sURL, sUSER, sPASSWD);
		stmt = con.createStatement();
	    }
	catch (Exception e)
	    {
		System.err.println ("Problem connecting to" + sURL + ":");
		System.err.println (e.getMessage());
		if(con != null){
		    try{con.close();}
		    catch(Exception e2){};
		}
		return;
	    }//catch ends


The Host based authentication (pg_hba.config) of the database are as follows
-
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust

******************************************************
can anyone suggest where i m missing. Really urgent.i hope the info i hv
given is sufficient.





view thread (4+ messages)  latest in thread

Message-ID: <46984.59.160.112.41.1181204514.squirrel@imtech.res.in>
Permalink:  ../46984.59.160.112.41.1181204514.squirrel@imtech.res.in/
Also on:    postgresql.org/message-id/46984.59.160.112.41.1181204514.squirrel@imtech.res.in

 · 

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-jdbc@postgresql.org
  Cc: mamoon@imtech.res.in
  Subject: Re: Failed to load jdbc driver
  In-Reply-To: <46984.59.160.112.41.1181204514.squirrel@imtech.res.in>
  References: <46984.59.160.112.41.1181204514.squirrel@imtech.res.in>

* 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