Trying to connect java to the heroku database (postgre), I have checked the url several times and have no errors. I am not using hibernate. By pgadmin I can insert into the bank normally. How to fix this error? Should I make any changes 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>