John Dunlap wrote:
> I've been looking for a solution to this error for a few days now.
> Everything I've found says that the problem should be that I have a
> malformed url but I've gone over it dozens of times and I don't think
> that it's wrong (I wish it was). I'm trying to use hibernate tools to
> generate my database schema through the JDBC driver.
>
> I'm getting the following stack trace,
> java.sql.SQLException: No suitable driver found for
> jdbc:postgresql://localhost:5432/mydatabase
> at java.sql.DriverManager.getConnection(DriverManager.java:602)
[...]
I don't know anything about Hibernate, but this error suggests that
the system does not know the PostgreSQL JDBC driver.
There are several ways to register it:
- Use the class org.postgresql.Driver, for example with the statement
Class.forName("org.postgresql.Driver");
- Start the Java Virtual Machine with the flag
-Djdbc.drivers=org.postgresql.Driver
You'll probably have to figure out how to do that in Hibernate,
but it should work exactly as with other JDBC drivers.
Yours,
Laurenz Albe