pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Mads N. Vestergaard <mnv@timmy.dk>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: java.sql.SQLException: No suitable driver
Date: Fri, 28 Apr 2006 19:24:57 +0900
Message-ID: <4451ED79.6020000@opencloud.com> (raw)
In-Reply-To: <4451E911.7010905@timmy.dk>
References: <4450B6E2.3020503@timmy.dk>
	<AEE99EF3-AC28-488F-AAC7-DE9B87FE1A03@fastcrypt.com>
	<4450C7C4.7000503@timmy.dk>
	<B82B73E6-A7EC-462B-AE49-F934661CE9DF@fastcrypt.com>
	<4450CB39.1070205@timmy.dk>
	<37D75CA0-89B0-45F4-B183-88F06B3A3304@fastcrypt.com>
	<4451DC55.70409@timmy.dk>
	<4451E889.4070004@opencloud.com>
	<4451E911.7010905@timmy.dk>

Mads N. Vestergaard wrote:
> Hi Aliver,
> 
> there isn't any conditional files in the environment variable CLASSPATH,
> and the program runs fine, it just can't connect to the database.

I am talking about both the CLASSPATH environment variable and the -cp 
command line argument. In my experience, if you specify -jar, both are 
ignored and classes are only loaded from the standard locations, and the 
single jarfile parameter given to -jar ("program.jar" in your case).

Have you tried the command line I suggested?

>> java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar ProgramMainClass

Please try this and let us know if it works.

I would also suggest that silently ignoring ClassNotFoundException, as 
the code you originally posted does, is a Really Bad Idea. That code is 
masking the real source of the error: namely, that the driver classes 
are *not* in your classpath.

-O



view thread (17+ messages)  latest in thread

Message-ID: <4451ED79.6020000@opencloud.com>
Permalink:  ../4451ED79.6020000@opencloud.com/
Also on:    postgresql.org/message-id/4451ED79.6020000@opencloud.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-jdbc@postgresql.org
  Cc: oliver@opencloud.com, mnv@timmy.dk
  Subject: Re: java.sql.SQLException: No suitable driver
  In-Reply-To: <4451ED79.6020000@opencloud.com>
  References: <4450B6E2.3020503@timmy.dk> <AEE99EF3-AC28-488F-AAC7-DE9B87FE1A03@fastcrypt.com> <4450C7C4.7000503@timmy.dk> <B82B73E6-A7EC-462B-AE49-F934661CE9DF@fastcrypt.com> <4450CB39.1070205@timmy.dk> <37D75CA0-89B0-45F4-B183-88F06B3A3304@fastcrypt.com> <4451DC55.70409@timmy.dk> <4451E889.4070004@opencloud.com> <4451E911.7010905@timmy.dk> <4451ED79.6020000@opencloud.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