JDBC Returns empty result set,but records are present in database
<p>public class alldata {</p>

<pre><code>public static void main(String arg[])
{

    String str;
    try
    {
       Class.forName("oracle.jdbc.driver.OracleDriver");

         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","root");
           PreparedStatement stmt2;

         String sql="select * from RECORDDATA where ID= ? and COMPANY_NM= ?";
        stmt2=con.prepareStatement(sql);
         int i=5;
        str="Audi";
         try
         {

             stmt2.setInt(1, i);
             System.out.println("after setting id");
             stmt2.setString(2,str);
             System.out.println("after setting string");
         }
         catch(Exception iner)
         {
             System.out.println("int coulnm"+iner);
         }
        try
        { 

         ResultSet showdata=stmt2.executeQuery();
         System.out.println("after rs");


            while(showdata.next())
         {

             System.out.println("in next");
             System.out.println("\n"+showdata.getInt(1)+showdata.getString(2)+showdata.getString(3)+showdata.getString(4)+showdata.getString(5)+showdata.getString(6)+showdata.getString(7));
             System.out.println("after next");
         }
    }catch(Exception e)
    {
        e.printStackTrace();
    }
}catch(Exception e2)
{
    e2.printStackTrace();
}

}
}
</code></pre>

<p>if i uses hardcoded values ID=5 and COMPANY_NM=Audi it retrives 3 records from database... but my program accepts these value dynamically from user...so that is not working.... please help...i m stuck at this stage...
<code>showdata.next() method</code> does not executing.. although there are 3 records are present in database.</p>