Java equivalent for PHP's mysql_real_escape_string()

后端 未结 7 666
温柔的废话
温柔的废话 2021-01-11 10:17

Is there a Java equivalent to PHP\'s mysql_real_escape_string() ?

This is to escape SQL injection attempts before passing them to Statement.execute().

I know

相关标签:
7条回答
  • 2021-01-11 10:55

    Do not assume that PreparedStatements are slower. Try it, measure it, and then judge.

    PreparedStatements should always be used in preference to Statement, pretty much without exception, especially when SQL injection attacks are what you're trying to avoid.

    0 讨论(0)
提交回复
热议问题