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 DB4F411F60BF for ; Thu, 27 Apr 2006 09:29:02 -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 09003-06-2 for ; Thu, 27 Apr 2006 09:28:51 -0300 (ADT) X-Greylist: delayed 00:06:37.572388 by SQLgrey- Received: from mail.jay.net (mail.jay.net [81.19.224.84]) by postgresql.org (Postfix) with ESMTP id 5F2E811F60B1 for ; Thu, 27 Apr 2006 09:28:49 -0300 (ADT) Received: (qmail 4715 invoked by uid 509); 27 Apr 2006 12:22:07 -0000 Received: from 81.7.181.42 by mail.jay.net (envelope-from , uid 502) with qmail-scanner-1.24st (clamdscan: 0.87.1/635. spamassassin: 3.1.1 perlscan: 1.24st. Clear:RC:1(81.7.181.42):. Processed in 0.046048 secs); 27 Apr 2006 12:22:07 -0000 Received: from unknown (HELO server002.befree.dk) ([81.7.181.42]) (envelope-sender ) by mail.jay.net (qmail-ldap-1.03) with SMTP for ; 27 Apr 2006 12:22:07 -0000 Received: from [192.168.1.12] ([80.62.40.30]RDNS failed) by server002.befree.dk with InterScan Messaging Security Suite; Thu, 27 Apr 2006 14:21:48 +0200 Message-ID: <4450B6E2.3020503@timmy.dk> Date: Thu, 27 Apr 2006 14:19:46 +0200 From: "Mads N. Vestergaard" User-Agent: Thunderbird 1.5 (X11/20060113) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: java.sql.SQLException: No suitable driver Content-Type: multipart/alternative; boundary=------------030204070508050400070507 X-imss-version: 2.038 X-imss-result: Passed X-imss-approveListMatch: *@timmy.dk X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/168 X-Sequence-Number: 15102 This is a multi-part message in MIME format. --------------030204070508050400070507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Everybody, when I try to run my program, I get the following error message: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Database.(Database.java:20) at Gateway.main(Gateway.java:19) Exception in thread "main" java.lang.NullPointerException at Database.SQLget(Database.java:71) at Gateway.main(Gateway.java:33) My connect code is: try { Class.forName("org.postgresql.Driver"); }catch (ClassNotFoundException e){ } try { db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode"); } catch (SQLException e) { e.printStackTrace(); } On my system I have putted the jdbc driver for postgres into the classpath: hostname:~$ echo $CLASSPATH /usr/share/java/pg74.216.jdbc3.jar Java version: hostname:~$ java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing) As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error. I've also tried to run the program with the -classpath flag, with the same result. Have I simply forgotten something, or is there something seriously wrong? Thanks in advance. --------------030204070508050400070507 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Hi Everybody, when I try to run my program, I get the following error message:
java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at Database.<init>(Database.java:20)
        at Gateway.main(Gateway.java:19)
Exception in thread "main" java.lang.NullPointerException
        at Database.SQLget(Database.java:71)
        at Gateway.main(Gateway.java:33)
My connect code is:
try {
    Class.forName("org.postgresql.Driver");
      }catch (ClassNotFoundException e){
      }
      try {
        db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode");
      } catch (SQLException e) {
        e.printStackTrace();
      }
On my system I have putted the jdbc driver for postgres into the classpath:
hostname:~$ echo $CLASSPATH
/usr/share/java/pg74.216.jdbc3.jar
Java version:
hostname:~$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error. 
I've also tried to run the program with the -classpath flag, with the same result.
Have I simply forgotten something, or is there something seriously wrong?

Thanks in advance.
--------------030204070508050400070507--