P
pet0etie
hello,
i'm facing this problem :
suppose i ha a single query that is entered by a user
before saving the query i want to check if its syntax is good
is there an easy way to do this ?
the easiest way would be something like :
String query = "select * from table1 where field1 > 0";
try {
Class.forName(DB_CLASS);
Connection conn =
DriverManager.getConnection(DB_DRIVER,DB_USER,DB_PASSW);
Statement stmt = conn.createStatement();
ResultSet rslt = stmt.executeQuery(query);
rslt.close();
stmt.close();
conn.close();
} catch ( Exception e ) {
//error in query
}
but the problem is that the executeQuery() could take very long (with more
complex query's)
is there an alternative solution for this ?
thanks in advance,
pet0etie
i'm facing this problem :
suppose i ha a single query that is entered by a user
before saving the query i want to check if its syntax is good
is there an easy way to do this ?
the easiest way would be something like :
String query = "select * from table1 where field1 > 0";
try {
Class.forName(DB_CLASS);
Connection conn =
DriverManager.getConnection(DB_DRIVER,DB_USER,DB_PASSW);
Statement stmt = conn.createStatement();
ResultSet rslt = stmt.executeQuery(query);
rslt.close();
stmt.close();
conn.close();
} catch ( Exception e ) {
//error in query
}
but the problem is that the executeQuery() could take very long (with more
complex query's)
is there an alternative solution for this ?
thanks in advance,
pet0etie