Why pgJDBC ?
PostgreSQL JDBC Driver allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. Is an open source JDBC driver written in Pure Java (Type 4), and communicates in the PostgreSQL native network protocol. Because of this, the driver is platform independent; once compiled, the driver can be used on any system.
Latest Releases
pgJDBC has released v42.5.0 on 24 August, 2022. Please see the release notes below.
Allows Java programs to connect to a PostgreSQL database using standard, database independent Java code
Provides complete implementation of the JDBC specification in addition to some PostgreSQL specific extensions
The current development driver supports eleven server versions and three java environments
Processing a simple query
This example will issue a simple query and print out the first column of each row using a Statement.
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM mytable WHERE columnfoo = 500");
while (rs.next()) {
System.out.print("Column 1 returned ");
System.out.println(rs.getString(1));
}
rs.close();
st.close();
Report a bug or Contribute ?
Report a security issue,
here.
See something that's wrong or unclear?
submit a PR.
Support Us
PostgreSQL is free.
Please support our work by making a
donation.