title: Query works on phpMyAdmin, but not in Java
body: <p>I'm using MySQL and JDBC to the database for a site in JSP.</p>
  
  <p>I generate an SQL query for a search command, the query works when I run it manually on phpMyAdmin and it return 1 row match.</p>
  
  <p>But after executing my query the <em>ResultSet</em> is empty (I can't get the values of the table).</p>
  
  <p>This is the code that executes the query:</p>
  
  <pre><code>public static Product findLikeProd(String ProductName)
  {
      Product Product = null;
      try
      {
          ResultSet rs = Database.executeSelect1("SELECT * FROM products WHERE prodName LIKE '%"+ProductName+"%' AND exist=1");
          if (rs.next())
          {
              Product = new Product(rs.getInt("PKid"), rs.getString("prodName"), rs.getString("description"), rs.getDouble("price"), rs.getInt("deliveryTime"), rs.getString("imgUrl"));
          }
          //Database.closeCon();
      }
      catch (SQLException e)
      {
          e.printStackTrace();
      }
      return Product;
  }
  </code></pre>
  
  <p>A query for example: </p>
  
  <blockquote>
    <p>SELECT * FROM Products WHERE prodName LIKE '%מהיר%' AND exist=1</p>
  </blockquote>
  
  <p>The code:</p>
  
  <pre><code>public synchronized static ResultSet executeSelect1(String sqlCmd) {
      ResultSet rs = null;
      try {
          MysqlDataSource ds = new MysqlConnectionPoolDataSource();
          ds.setServerName("localhost");
          ds.setDatabaseName("tarazJsp"); 
          con=ds.getConnection("root","");
  
          Statement st = con.createStatement();
          rs = st.executeQuery(sqlCmd); //The problem is here. rs is received(!=null) but I can't get his parameters.(empty)
  
      } catch (SQLException e) {
          e.printStackTrace();
      }
  
      return rs;
  }
  </code></pre>
  
  <p>When I try to get the string from <em>rs</em>, it throws an SQLException.</p>
  
  <p>How should I fix it?</p>