Connection cn = DriverManager.getConnection(road_to_DB);
Statment st = cn.createStatment();
//сам запрос:
if(st.executeQuery("SELECT * FROM users WHERE name = 'name'") == null) {
//TODO......
return;
}
ResultSet result = st.executeQuery("SELECT * FROM users WHERE name = 'name'");
if (!result.isBeforeFirst() ) {
// вернулось 0 строк
}
Returns:
true if the cursor is before the first row; false if the cursor is at any other position or the result set contains no rows