jdbc where like parameter

Solutions on MaxInterview for jdbc where like parameter by the best coders in the world

showing results for - "jdbc where like parameter"
Emerson
21 Mar 2016
1private List getTopics (Connection conn, String searchCriteria)
2throws SQLException
3{
4  List blogs = new LinkedList();
5  String query = "SELECT id, text FROM blogs WHERE UPPER(text) LIKE ?";
6  try
7  {
8    // going to do a search using "upper"
9    searchCriteria = searchCriteria.toUpperCase();
10
11    // create the preparedstatement and add the criteria
12    PreparedStatement ps = conn.prepareStatement(query);
13    ps.setString(1, "%" + searchCriteria + "%");
14    
15 ...
16 
17}