Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to connect postgresql database with java

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)
Source by www.postgresqltutorial.com #
 
PREVIOUS NEXT
Tagged: #connect #postgresql #database #java
ADD COMMENT
Topic
Name
4+1 =