I want to store a html syntax string in MySql table, for example <a href="https://www.google.com">Google</a>
. if im directly trying to insert this, im getting sql syntax error. I saw the same question in Store HTML into MySQL database, here the solution I got from above link is added one "'" before and after the url. So i need to know any alternative on this? Because if I'm adding this, im able to save that in db, but while fetching this i need to pass the same string in to a jsp page, so i need to remove that extra chars added while saving the link to db. To avoid this is ther any alternatives possible?
Elaborating my requirement : i need to store a string like <a href="https://www.google.com">Google</a>
into a table 'GoogleLinks' and column 'links' which have type Varchar. After that, i need to get the string back in a string variable and need to pass this to jsp page, where this string will come in between
tag. So is there any way to store this in database without modifying the html string, or is there any method we can apply before and after to avoid sql syntax error. Java is my backend language.