X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8195011F6029 for ; Fri, 28 Apr 2006 07:25:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 34324-09 for ; Fri, 28 Apr 2006 07:24:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 829D411F600D for ; Fri, 28 Apr 2006 07:24:55 -0300 (ADT) Received: from 221x253x225x162.ap221.ftth.ucom.ne.jp ([221.253.225.162] helo=[192.168.1.182]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1FZQ9e-0000Pb-VU; Fri, 28 Apr 2006 22:24:55 +1200 Message-ID: <4451ED79.6020000@opencloud.com> Date: Fri, 28 Apr 2006 19:24:57 +0900 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Mads N. Vestergaard" CC: pgsql-jdbc@postgresql.org Subject: Re: java.sql.SQLException: No suitable driver References: <4450B6E2.3020503@timmy.dk> <4450C7C4.7000503@timmy.dk> <4450CB39.1070205@timmy.dk> <37D75CA0-89B0-45F4-B183-88F06B3A3304@fastcrypt.com> <4451DC55.70409@timmy.dk> <4451E889.4070004@opencloud.com> <4451E911.7010905@timmy.dk> In-Reply-To: <4451E911.7010905@timmy.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/185 X-Sequence-Number: 15119 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