• Post Reply Bookmark Topic Watch Topic
  • New Topic

Weird JDBC Result Set behavior , Oracle - JDK 1.2.2  RSS feed

Braj Prasad
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a result set object, which contains the value of a string(VARCHAR2) field from the Database. When a getBoolean is called on it(this was done mistakenly for a String field), it returned a TRUE, when the DB field had a not NULL value, else it returned FALSE. This behaviour was on my windows desktop(Win2K). However, when the same piece of code was run from the Unix environment, it threw a NumberFormatException (and rightly so). Both the cases were run against the same database.
Seems to be an issue with Oracle's implementation of the JDBC drivers ? Any thoughts/views ?
Here's the snippet of the code
String query = "select col1_name from table_name where primaryKeyVal=1";
// where col1_name is defined as VARCHAR2 field in Database
con = DriverManager.getConnection(url,username,password);
Statement stmt = con.createStatement();
ResultSet rs= stmt.executeQuery(query);
boolean lbTmp = rs.getBoolean(1);
System.out.println("Boolean is : " + lbTmp);
catch(SQLException sqle)
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!