prepareStatement doesn't Like it when i use: LIKE %XYZ%'
Hey,
I want to execute this:
st = conn.prepareStatement("select msgid from log.msg_info where subject like ? ");
st.setString(1, "'%" + (String)names.get(i) + "%' ");
ResultSet rs = st.executeQuery();
while (rs.next()){//for each mail with that timestamp
......
}
rs.close();
-
The problem is that whenever i execute the query i get an empty result set
but, if i got to the database and execute the query manually i get the result i needed.
here is an example of the query:
"select msgid from log.msg_info where subject like '%57.52.0923%' "
i tried using escape chars but that didn't do the trick either.
can anyone help ?

