"No Suitable Driver" - Mailing list pgsql-jdbc

From Guy McArthur
Subject "No Suitable Driver"
Date
Msg-id Pine.LNX.4.33.0110241553270.10396-100000@astronomica.as.arizona.edu
Whole thread Raw
Responses Re: "No Suitable Driver"
List pgsql-jdbc
Hi, I'm trying to get a small test program going. I have built PostgreSQL
7.1.3 on RedHat 6.2 with --java, installed and created databases, verified
with psql. The postgresql.jar is on my classpath.

My pg_hba.conf has:
local        all                                           password
host         all         127.0.0.1     255.255.255.255     password

Here is my code:

import java.sql.*;

public class PostgresTest {
   public static void main(String[] args) {
     try {
      Connection db =
DriverManager.getConnection("jdbc.postgresql:test&user=test&password=test");
// I've also tried all the permutations of getConnection() and urls.
// db, user, and password names have been changed to protect the innocent
// I've also tried Class.forName("org.postgresql.Driver") and
// Class.forName("org.postgresql.Driver").newInstance() instead of the arg.
      db.close();
     } catch(Throwable t) {
         t.printStackTrace(System.out);
     }
   }
}

--
Running it with:

java -Djdbc.drivers=org.postgresql.Driver PostgresTest
where the db has been started by user postgres with:
/usr/local/pgsql/bin/postmaster -i -D /data/pgsql >/data/pgsql/pgsql.log 2>&1 &

And the error is:

java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(DriverManager.java:537)
        at java.sql.DriverManager.getConnection(DriverManager.java:199)
        at PostgresTest.main(PostgresTest.java:6)


What is wrong?

--
Guy McArthur * email{guym@arizona.edu} http{guymcarthur.com}





pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] DatabaseMetadata patch
Next
From: "Dave Cramer"
Date:
Subject: Re: "No Suitable Driver"