Обсуждение: jdbc
I'm having trouble getting the postgresql jdbc driver to work. Here's my error: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code) at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code) at DBBean.<init>(DBBean.java,Compiled Code) at DBBean.main(DBBean.java, Compiled Code) I'm running Linux with the 1.2.2 jdk. I'm running pgsql 7.0.2. CLASSPATH=/usr/lib/pgsql/jdbc7.0-1.2.jar:. Any help would be appreciated. Wayne
Did you use 'Class.forName("org.postgresql.Driver")', to preload the
driver prior to calling getConnection?
On Wed, Dec 27, 2000 at 10:01:09PM -0500, Wayne Davis wrote:
> I'm having trouble getting the postgresql jdbc driver to work. Here's my error:
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
> at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
> at DBBean.<init>(DBBean.java, Compiled Code)
> at DBBean.main(DBBean.java, Compiled Code)
>
> I'm running Linux with the 1.2.2 jdk.
> I'm running pgsql 7.0.2.
>
> CLASSPATH=/usr/lib/pgsql/jdbc7.0-1.2.jar:.
>
> Any help would be appreciated.
>
> Wayne
At 10:01 PM -0500 12/27/00, Wayne Davis wrote:
>I'm having trouble getting the postgresql jdbc driver to work.
>Here's my error:
>java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(DriverManager.java,
>Compiled Code)
> at java.sql.DriverManager.getConnection(DriverManager.java,
>Compiled Code)
> at DBBean.<init>(DBBean.java, Compiled Code)
> at DBBean.main(DBBean.java, Compiled Code)
Maybe you had the same naming issue I found (see below).
John DeSoi, Ph.D.
-------
X-From_: desoi@icx.net Wed Dec 20 10:57:45 2000
X-Sender: desoi@mailhub.icx.net (Unverified)
Date: Wed, 20 Dec 2000 10:55:39 -0500
To: peter@retep.org.uk
From: John DeSoi <desoi@icx.net>
Subject: JDBC documentation error
Hi Peter,
I'm just getting started with postgres and JDBC. I wanted to mention
a documentation error that might cause considerable pain for other
newbies like me :)
You have:
In the first method, your code implicitly loads the driver using the
Class.forName() method. For Postgres, you would use:
Class.forName("postgresql.Driver");
In using this, my application kept crashing (of course it should have
given me an error message, but for some reason it just crashed). I
finally got things working by changing it to
Class.forName("org.postgresql.Driver");
Thanks for all your work,
John DeSoi, Ph.D.