Handling Boolean resultset in java -


I have a query that returns string value, my query is

select case Style_packing_spec From where style_id = 1701) then 'donutproyed' and 'go ahead' end It returns results as

 ? Case? ---------- Donut Process  

How to execute it in Java, how to handle this result set, I tried this way

  string sql = "query"; ResultSet rs = stmt.executeQuery (sql);  

This gives Nullpointerexception string str = rs.getString (1);

I have never left the boolean with a query (Oracle does not do it ...), but I It seems that it works. You just need to go to the first row of the result, and the column index starts with 1 (not 0).

  resultsetset rs = stmt.executeQuery (SQL); Try {rs.next (); // First row return rsget boolean (1); // First column 1} is finally {rs.close ();   Update:   

It shows that the mismatched error can not be converted from Boolean to Boolean

Are you using Java 1.4? For Java5 and above, it should be kept in mind by auto-boxing. But you can also fix this by using an old Boolean variable compared to the JDBC return:

  boolean str = rsgetbouolean (1); // I do question the variable name, though  

Comments