Protecting your MySQL database from SQL injection
linux.com
linux.com
This is just silly. There is a really simple way to prevent all SQL injection - use parameterized sql.
The best I found was http://www.codinghorror.com/blog/archives/000275.html but I'm hoping to get something that better describes what I should be doing with parameterized sql.
Thanks
PreparedStatement stmt = conn.prepareStatement("UPDATE accounts set username=?, password=? where id=?");
stmt.setString(1, "foo");
stmt.setString(2, "bar");
stmt.setInt(3, 49);
stmt.executeUpdate();
As you see, very easy to do, and separates SQL from data.