PgJDBC: "no suitable driver found" when following tutorial, why?
Posted
by
Celeritas
on Stack Overflow
See other posts from Stack Overflow
or by Celeritas
Published on 2012-10-28T02:43:03Z
Indexed on
2012/10/28
5:01 UTC
Read the original article
Hit count: 229
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.
© Stack Overflow or respective owner