1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public ResultSet rqt(String query){
try{
Class.forName("org.postgresql.Driver");
System.out.println("Driver OK");
String url="jdbc.postgresql://localhost:5432/bdd";
String user="postgres";
String passwd="coincoin";
Connection conn=DriverManager.getConnection(url, user, passwd);
Statement state = conn.createStatement();
ResultSet result = state.executeQuery(query);
ResultSetMetaData resultMeta = result.getMetaData();
state.close();
return result;
}catch(Exception e){
e.printStackTrace();
}
return null;
} |