I can generate an SQL query from user input.
Problem is, how do I take that string, throw it at the database and get the response?
Examples online explain fuck all and I am completly lost. HALP!
private static void dbComm(DBConnection con, String command) throws Exception{
Statement state = con.connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
//Statement stmt = con.createStatement();
try{
//??? ↓
state.executeQuery(command);
ResultSet response = state.getResultSet();
response.next();
//??? ↑
System.out.println("Success");
System.out.println(response);
} catch(Exception e){
System.out.println("Error");
e.printStackTrace();
}
}