Escaping a full line in insert statement H2

I am trying to avoid a whole line to be inserted into a longtext or varchar. Basically I have a string full of all types of special characters and special words (like LIKE), and I just want to avoid all this so that I can insert it into my H2 database.

I asked a few friends and they said that I should try to serialize the data. Is this the correct way to insert random strings in db? Should I try to do this with prepared statements?

Sorry, I'm new to H2 and not very good at SQL. Thanks for the help in advance!

+3
source share

All Articles