I am new to enterprise java. I'm trying to get eclipse to connect to a postgres db. I've downloaded postgresql-9.2-1002.jdbc4.jar
and postgresql-9.2-1002.jdbc3.jar
and put them both in the plugins folder in eclipse. I have a db called personnel setup in pgAdmin3 (localhost:5432). It seems like my code is connecting to the db properly, based on these links...
I have code that I think will connect properly to the DB. But it throws the error shown below. The stack track says it is a driver issue.
Did I put the drivers in the right spot? Do I need to configure postgres to take "remote" connections? I am new to the environment so I am not sure what my next steps should be to debug. It seems like I downloaded the right drivers and put up the right url.
String url = "jdbc:postgresql://localhost:5432/personnel";
String user = "root";
String password = "secret";
public String getDataFromDB(int personID){
try {
con = DriverManager.getConnection(url, user, password); //Errors out with Source not found.
...
prints the stack trace
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/personnel
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at myCon.personContactInfo(myCon.java:21)
at myTestConnection.main(myTestConnection.java:7)