title: Java prepared like statement with an integer
body: <p>My problem, concerning prepared statements in java:</p>
  
  <pre><code>SELECT TrackingId FROM table where TrackingId = 5735053
  </code></pre>
  
  <p>TrackingId is an integer column in the database. Whe i change the query to:</p>
  
  <pre><code>SELECT TrackingId FROM table where TrackingId = '5735053'
  </code></pre>
  
  <p>it works fine as he converts it automaticly. Same goes to this query:</p>
  
  <pre><code>SELECT TrackingId FROM table where TrackingId LIKE '%5735%'
  </code></pre>
  
  <p>This works fine and the database is finding results. In java i want to pass the input value of the user to the query. It works with String and the like statement but not with int:</p>
  
  <pre><code>String query = "SELECT AnyString FROM table where AnyString like ?";
  
  connectDatabase();
  
  pstmt = connection.prepareStatement(query);
  pstmt.setString(1, "%"+input+"%");
  result = pstmt.executeQuery();
  </code></pre>
  
  <p>Now i want to pass an Integer through this statement and i have tried many things but always 0 results. So this won't work:</p>
  
  <pre><code>String query = "SELECT AnyInt FROM table where AnyInt like ?";
  
  connectDatabase();
  
  pstmt = connection.prepareStatement(query);
  pstmt.setString(1, "%"+input+"%");
  result = pstmt.executeQuery();
  </code></pre>
  
  <p>But if i type the query in my database programm it works fine and he is finding results. Can anybody help me with this here?</p>