Does MySQL's JDBC driver have a facility for parsing SQL?
I'm writing a Java tool to validate SQL statements. For SELECT queries, I can do it with Connection.prepareStatement
and PreparedStatemet.getMetaData
. No exceptions == good query. Unfourtunately it doesn't work with eg. INSERT statements -- errors in query create exception only at executing t开发者_运维知识库he statement.
Is there a way to parse SQL via JDBC without executing the statement? An internal method maybe?
Unfourtunately I was also unable to find source code for Connector/J -- I'd be grateful for links to it.
OK, found an answer myself, need to call a protected method:com.mysql.jdbc.ServerPreparedStatement.getInstance(MySQLConnection conn, String sql, String catalog, int, int)
精彩评论