java中连接postgresql基本代码
try { Class.forName( "org.postgresql.Driver" ).newInstance(); String url = "jdbc:postgresql://localhost:5432/postgres" ; Connection con = DriverManager.getConnection(url, "postgres" , "123" ); Statement st = con.createStatement(); return st; } catch (Exception ee) { System.out.print(ee.getMessage()); return null; }