This question is an extension of this question. It is good that I can get MetaData. However reading the documentation I have understood that this data is only for SELECT type requests. And I need more information, is it UPDATE or SELECT and etc. Can I get this information without parsing SQL request? What will be if I use executeQuery() or getMetaData() to UPDATE or DELETE request?
Share
Meta data is available only on
ResultSetandDatabaselevel but not onUpdateandDeletetype of queries. TheStatement.execute( String sql )can be used to identify if the query returnsResultSet(s)or an integer amount of records affected.Documentation says:
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods
getResultSetorgetUpdateCountto retrieve the result, andgetMoreResultsto move to any subsequent result(s).This method returns
true if the first result is a ResultSet object; false if it is an update count or there are no resultsThere is no any direct method that tells you if the query being is used is an
Updateor aDelete. You require to parse it explicit and identify.