Java JDBC PostgreSQL Connection getConnection()

Here you can find the source of getConnection()

Description

get Connection

License

Apache License

Declaration

public static Connection getConnection() throws SQLException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

public class Main {
    public static Connection getConnection() throws SQLException {
        String url = "jdbc:postgresql://localhost/marketplace";
        Properties props = new Properties();
        props.setProperty("user", "marketplace");
        props.setProperty("password", "test");
        return DriverManager.getConnection(url, props);
    }//from www. j  a  v  a2s.co m
}

Related

  1. ClearDatabase()
  2. createConnection()
  3. getConnection()
  4. getDataFromTable(String tableName, String[] columns)
  5. getDBConnection()
  6. getListDatabaseFromMaster()