Java General Error On Insert…???

前端 未结 4 1047
误落风尘
误落风尘 2020-12-22 06:29

I am trying to do an Insert, Update and Delete on a table in MS Access. Everything works fine

for a SELECT statement. But when doing the o

4条回答
  •  粉色の甜心
    2020-12-22 07:22

    The main reason for using a PreparedStatement is security. Generating a SQL query by concating strings is unsafe as the variable parts may contain SQL statements entered by a user. This would allow to execute statements like DROP TABLE * to the user (see SQL Injection). Theres is is a good idea only to use PreparedStatemnts if the SQL query is not static (doe snot contain variable parts). Therefore it would be better also to use PreparedStatement for SELECT statements.

提交回复
热议问题