When you are dealing with databases one of the most common things you have to do is to escape out all single quotes in text being entered into the DB to stop PostgreSQL/MySQL/*SQL having a cow and to prevent injection attacks.

In most languages this is trivial, take Perl for example

my $sqlText =~ s/'/\\'/g;

Could it be that easy in Java … not on your life!

Read more

Tagged with:

« go back