Support Questions
Find answers, ask questions, and share your expertise

Like search using JDBC driver 2.5.4

Like search using JDBC driver 2.5.4

New Contributor

I am trying to do a like search on percentage symbol from my java rest application. Something like 

select * from table1 where name like '%\%%'.

 

However as a standard practice I have to parameter bind my search values so my java query looks like

select * from table1 where name like :name 

 

:name to be replaced by the search value by the driver using setParameter() function

 

The second method of querying does not give me correct results when I try backslashes as escape sequence, so my search on SQL wildcards (%,_,\) fails.

 

This issue is not observed when I sent the values as quoted.

eg:

name = "%\%%" works.

 

Am I missing something here? Help much needed and appreciated