PgJDBC: "no suitable driver found" when following tutorial, why?
- by Celeritas
I'm writing a Java program that queries a PostgreSQL database. I'm following this example and have trouble here:
connection = DriverManager.getConnection(
"jdbc:postgresql://127.0.0.1:5432/testdb", "mkyong",
"123456");
According to the JavaDoc for DriverManager the first string is "a database url of the form jdbc:subprotocol:subname. When I connect to the server I type in psql -h dataserv.abc.company.com -d app -U emp24 and give the password qwe123 (for example sake). What should the first argument of getConnection be?
I've tried
connection = DriverManager.getConnection(
"jdbc:postgresql://dataserv.abc.company.com", "emp24",
"qwe123");
and get the run time error: no suitable driver found.
I've download JDBC4 Postgresql Driver, Version 9.2-1000.