📜  如何使用 java 连接 postgresql 数据库 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:33.745000             🧑  作者: Mango

代码示例1
public Connection connect() {
        Connection conn = null;
        try {
            conn = DriverManager.getConnection(url, user, password);
            System.out.println("Connected to the PostgreSQL server successfully.");
        } catch (SQLException e) {
            System.out.println(e.getMessage());
        }

        return conn;
    }
Code language: Java (java)