0
Trying to connect java to the Heroku database (postgre), I have checked the url several times and there are no errors. I am not using Hibernate. By pgadmin I can enter it into the database normally. How to fix this error? Should I make a change to pom.xml?
private static Connection getConnection() {
try {
String dbUrl = "jdbc:postgresql://ec2-54-83-27-147.compute-1.amazonaws.com:5432/d1o8bcicho5jj?user=usuario&password=senha&sslmode=require";
return DriverManager.getConnection(dbUrl);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
Error:
java.sql.Sqlexception: No suitable driver found for jdbc:postgresql://ec2...
pom.xml:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>
Downloaded and added the postgree driver to JDBC in the project’s classpath?
– user28595
Even though I won’t run locally I need the driver?
– Bruno Brito
ALWAYS! The driver is a kind of translator, without it the bank will not understand any commands you pass, so that error arises.
– user28595
I edited with a part of the pom, the driver would be that?
– Bruno Brito
Or should I download and put in the classpath msm?
– Bruno Brito