pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedFailed to load jdbc driver
4+ messages / 3 participants
[nested] [flat]
* Failed to load jdbc driver
@ 2007-06-07 08:21 Mamoon Rashid <mamoon@imtech.res.in>
2007-06-07 08:41 ` Re: Failed to load jdbc driver Heikki Linnakangas <heikki@enterprisedb.com>
2007-06-07 11:28 ` Re: Failed to load jdbc driver Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 4+ messages in thread
From: Mamoon Rashid @ 2007-06-07 08:21 UTC (permalink / raw)
To: pgsql-jdbc
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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Failed to load jdbc driver
2007-06-07 08:21 Failed to load jdbc driver Mamoon Rashid <mamoon@imtech.res.in>
@ 2007-06-07 08:41 ` Heikki Linnakangas <heikki@enterprisedb.com>
2007-06-07 09:50 ` Re: Failed to load jdbc driver Heikki Linnakangas <heikki@enterprisedb.com>
1 sibling, 1 reply; 4+ messages in thread
From: Heikki Linnakangas @ 2007-06-07 08:41 UTC (permalink / raw)
To: Mamoon Rashid <mamoon@imtech.res.in>; +Cc: pgsql-jdbc
Mamoon Rashid wrote:
> 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
Looks like a classpath problem. Make sure the driver jar is in the
classpath your servlet engine use. You might want to add a
"e.printStackTrace()" to the catch-blocks as well to get a more detail
error message.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Failed to load jdbc driver
2007-06-07 08:21 Failed to load jdbc driver Mamoon Rashid <mamoon@imtech.res.in>
2007-06-07 08:41 ` Re: Failed to load jdbc driver Heikki Linnakangas <heikki@enterprisedb.com>
@ 2007-06-07 09:50 ` Heikki Linnakangas <heikki@enterprisedb.com>
0 siblings, 0 replies; 4+ messages in thread
From: Heikki Linnakangas @ 2007-06-07 09:50 UTC (permalink / raw)
To: Mamoon Rashid <mamoon@imtech.res.in>; +Cc: pgsql-jdbc
Please keep the list cc:d so that others can help and learn from the
discussion.
Mamoon Rashid wrote:
> The CLASSPATH is "CLASSPATH=/var/www/cgi-bin/postgresql-8.2-505.jdbc4.jar:"
> document root is "/var/www/html" and the server root is "/etc/httpd".
> Please make me know which classpath my server is using?
How to configure the classpath depends on the servlet engine you're
using. Please refer to the user manual of the servlet engine, I'm sure
there's examples of using a JDBC driver in there.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Failed to load jdbc driver
2007-06-07 08:21 Failed to load jdbc driver Mamoon Rashid <mamoon@imtech.res.in>
@ 2007-06-07 11:28 ` Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 4+ messages in thread
From: Dave Cramer @ 2007-06-07 11:28 UTC (permalink / raw)
To: Mamoon Rashid <mamoon@imtech.res.in>; +Cc: pgsql-jdbc
Hi,
Are you trying to use the driver in an applet ? If so you have to add
it to the resources of the applet.
Dave
On 7-Jun-07, at 4:21 AM, Mamoon Rashid wrote:
> 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.
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-06-07 11:28 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-07 08:21 Failed to load jdbc driver Mamoon Rashid <mamoon@imtech.res.in>
2007-06-07 08:41 ` Heikki Linnakangas <heikki@enterprisedb.com>
2007-06-07 09:50 ` Heikki Linnakangas <heikki@enterprisedb.com>
2007-06-07 11:28 ` Dave Cramer <pg@fastcrypt.com>
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