Function to Escape MySQL
Posted by: ian s
Date: October 20, 2009 05:05AM

Hello everyone. I was wondering if there is a built in function which escapes MySql. Normally I don't need this because I use prepared statements which escapes everything automatically. But in this particular case I need to dynamically build the query. To prevent SQL injection I need to escape special mysql characters.

Right now I'm using StringEscapeUtils.escapeSql(String) which is part of the commons lang apache library - http://commons.apache.org/lang/api-release/index.html

From the API description this is for SQL not MySQL. So my question is does anyone know of a function which does the same thing as escapeSql but for MySql. Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Function to Escape MySQL
October 20, 2009 05:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.