|
Answer» Benefits of PREPAREDSTATEMENT over Statement interface are: - It performs faster COMPARED to the Statement because the Statement needs to be compiled each time when we run the code whereas the PreparedStatement is compiled once and then executed only on runtime.
- It can execute parametrized QUERIES. But Statement can only run static queries.
- The query used in PreparedStatement looks similar each time, so the database can REUSE the previous access plan. Statement inline the parameters into the string, so the query doesn’t look to be the same every time which prevents reusage of cache.
|