0

I am expirencing a problem with the JDBC driver. My database is at postgres://... but the driver only works with postgresql://.... What should I do?

I am trying to connect to a heroku postgres database from java.

CODE:

Connection conn = null;

Below I am trying with postgresql://

Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection("jdbc:postgresql://bfjxvagjalvmcu:n9Y2VO0myQ5sgWVrzJbLX59TD3@ec2-54-204-15-41.compute-1.amazonaws.com:5432/*****&username=******&password=******&ssl=true");

And I get the error:

org.postgresql.util.PSQLException: The connection attempt failed.

And if I use this code, with postgres

Class.forName("org.postgresql.Driver");
conn = DriverManager.getConnection("jdbc:postgres://bfjxvagjalvmcu:n9Y2VO0myQ5sgWVrzJbLX59TD3@ec2-54-204-15-41.compute-1.amazonaws.com:5432/****&username=******&password=****&ssl=true");

I get the error:

java.sql.SQLException: No suitable driver found for jdbc:postgres://bfjxvagjalvmcu:n9Y2VO0myQ5sgWVrzJbLX59TD3@ec2-54-204-15-41.compute-1.amazonaws.com:5432/*******&username=********&password=*******&ssl=true
thesecretmaster
  • 1,943
  • 1
  • 27
  • 37

0 Answers0