logo
Download Documentation Community Development Changelogs Security
/
  • Getting started
    • Getting the Driver
    • Importing JDBC
    • Loading the Driver
    • Preparing the Database Server for JDBC
    • Setting up the Class Path
  • Connect
    • Connection Pools and Data Sources
    • Connecting to the Database
    • Connection Fail-over
    • Unix sockets
  • Security
    • Using SSL
  • Query
    • Calling Stored Functions and Procedures
    • JDBC escapes
    • Getting results based on a cursor
    • Server Prepared Statements
    • Using the Statement or PreparedStatement Interface
  • Data types
    • Storing Binary Data
    • Arrays
    • Geometric Data Types
    • Large Objects
    • Timestamp Infinity
    • Using Java 8 Date and Time classes
  • PostgreSQL features
    • Accessing the Extensions
    • CopyManager
    • Listen / Notify
    • Parameter Status Messages
    • Physical and Logical replication API
  • Runtime
    • Using the Driver in a Multithreaded or a Servlet Environment
    • Logging using java.util.logging
    • Further Reading
  1. Home
  2. Documentation
  3. Getting started
  4. Importing JDBC
Edit this page on GitHub

Importing JDBC

This section describes how to load and initialize the JDBC driver in your programs.

Any source file that uses JDBC needs to import the java.sql package, using:

import java.sql.*;

NOTE

You should not import the org.postgresql package unless you are using PostgreSQL® extensions to the JDBC API.

Getting the Driver
Loading the Driver
  • pgJDBC
  • Public API
  • About PostgreSQL
  • Community
  • Github
  • Slack
  • Twitter
  • Mailing List
  • More
  • FAQ
  • Privacy
  • License
Copyright © 1996-2026 The PostgreSQL Global Development Group
  • Download
  • Documentation
  • Community
  • Development
  • Changelogs
  • Security
  • Getting started
  • Getting the Driver
  • Importing JDBC
  • Loading the Driver
  • Preparing the Database Server for JDBC
  • Setting up the Class Path
  • Connect
  • Connection Pools and Data Sources
  • Connecting to the Database
  • Connection Fail-over
  • Unix sockets
  • Security
  • Using SSL
  • Query
  • Calling Stored Functions and Procedures
  • JDBC escapes
  • Getting results based on a cursor
  • Server Prepared Statements
  • Using the Statement or PreparedStatement Interface
  • Data types
  • Storing Binary Data
  • Arrays
  • Geometric Data Types
  • Large Objects
  • Timestamp Infinity
  • Using Java 8 Date and Time classes
  • PostgreSQL features
  • Accessing the Extensions
  • CopyManager
  • Listen / Notify
  • Parameter Status Messages
  • Physical and Logical replication API
  • Runtime
  • Using the Driver in a Multithreaded or a Servlet Environment
  • Logging using java.util.logging
  • Further Reading