aspose file tools
The moose likes JDBC and the fly likes Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2" Watch "Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2" New topic
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();
}
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Weird JDBC Result Set behavior , Oracle 8.1.7.2 - JDK 1.2.2
 
Similar Threads
java stored procedure problems
processing resultset
SQL Error
quaick question
Using ResultSet.getString( )