title: How to add a string variable to a SQL query on a jdbc firebird connection
body: <p>I am trying to query a Firebird database from a Java application. This query contains 2 integer variables and 1 string. The query looks like this:</p>
  
  <pre><code>Statement statement = conn.createStatement();
  
  ResultSet rs = statement.executeQuery("select * from table where
    column1 &lt; " + intvariable1 + " and ( 
    column2 &gt; " + intvariable2 +" or column2 = 0) and 
    column3 = '" + stringvariable + "' ";
  
  Rs.next();
  syso(rs.getInt(1));
  </code></pre>
  
  <p>It appears that the <code>ResultSet</code> is empty but when I use a hardcoded string value instead of a variable I get the expected result. </p>
  
  <p>I also tried this with <code>preparedstatements</code> with the same result - it is only working without string variable.</p>
  
  <p>Any ideas what I am doing wrong?</p>
  
  <p>EDIT: Problem solved! The Stringvariable came from a BLOB Field and had some empty values within it. Calling the trim function deleted those.</p>