Note that there are some explanatory texts on larger screens.

plurals
  1. PO"No suitable driver" problem with Hibernate3, PostgreSQL 8.3 and Java 5
    primarykey
    data
    text
    <p>Does anybody know what's going on here:</p> <p>I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.jdbc3). When I change the jar in the classpath and switch to Java 5 (I do this in eclipse), I get the following error:</p> <pre><code>Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) &lt;Rows clipped for readability&gt; Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:545) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) </code></pre> <p>What's the problem here? I cannot see it. Here is my hibernate configuration:</p> <pre><code>&lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="connection.url"&gt;jdbc:postgresql:test&lt;/property&gt; &lt;property name="connection.username"&gt;postgres&lt;/property&gt; &lt;property name="connection.password"&gt;p&lt;/property&gt; &lt;property name="connection.pool_size"&gt;1&lt;/property&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/property&gt; &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;mapping resource="com/mydomain/MyClass.hbm.xml"/&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p><strong>EDIT:</strong> The longer, more usual form of the connection URL: <em>jdbc:postgresql://localhost/test</em> has the exact same behaviour.</p> <p>The driver jar is definitely in the classpath, and I also do not manage to get any errors with this direct JDBC test code:</p> <pre><code>public static void main(String[] args) throws Exception { Class.forName("org.postgresql.Driver"); Connection con=DriverManager.getConnection("jdbc:postgresql://localhost/test","postgres", "p"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload