| Author |
Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2
|
Braj Prasad
Greenhorn
Joined: Apr 08, 2002
Posts: 16
|
|
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 ? Thanks 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 try{ con = DriverManager.getConnection(url,username,password); Statement stmt = con.createStatement(); ResultSet rs= stmt.executeQuery(query); if(rs.next()) { boolean lbTmp = rs.getBoolean(1); System.out.println("Boolean is : " + lbTmp); } rs.close(); stmt.close(); con.close(); } catch(SQLException sqle) { sqle.printStackTrace(); }
|
 |
 |
|
|
subject: Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2
|
|
|