What does pre-compiling a JDBC PreparedStatement do?

后端 未结 2 1707
梦如初夏
梦如初夏 2021-01-11 16:51

What does \"precompiling\" a statement do, because I have seen that if I write a prepared statement with a bad SQL syntax that compilation does not report any problem!

2条回答
  •  猫巷女王i
    2021-01-11 17:46

    'statement compilation' is something that happens on the database which helps it return results faster and more efficiently. If you use a PreparedStatement then it allows the database to reuse a statement which was already compiled and saves having to do it again. Bad SQL will likely result in a badly compiles database statement, but not always.

提交回复
热议问题