Hello. I am using Jbuilder 6. We recently upgraged our Oracle Database from 22.214.171.124.0 to 126.96.36.199.0. Ever since the upgrade I have been unable to select a sequence value from my database within my java application. Here is the line of code that is failing: dataSet.setBigDecimal(primaryKeyName,sequenceGeneratorQueryDataSet.getBigDecimal("SEQ_NUM")); I get the following error: Attempt to get a BIGDECIMAL value from a DOUBLE value. The only changes that have occured in the databse was the previously mentioned database upgrade. Has anyone else had this problem? I have been looking at the patchsets' readme file but have not found what could have caused the problem. Any Ideas anyone?
Joined: Feb 07, 2003
For those that are interested. I logged a TAR with Oracle and found out the following: This is from Oracle: Starting on JDBC 188.8.131.52 there has been a change of behaviour on the datatype returned from getMetaData() in jdbc. If Oracle returns a NUMBER datatype to JDBC. The results of the datatype type output are different in 184.108.40.206 than in 220.127.116.11. This change of behaviour is experienced using JDBC THIN or OCI and independent to what version of the database they connect to. . In 8i and 18.104.22.168, A number datatype was mapped to: java type of: java.math.BigDecimal ============================= in 9014, 9202 and 10i, A number datatype is mapped to : java.lang.Integer ============================ According to java, sql datatype mappings table documented on the JDBC developers guide and reference: Table 20-1 Valid SQL Datatype-Java Class Mappings . (http://st-doc.us.oracle.com/9.0/9202/java.920/a96654/ref.htm#1000969) . See 3.0 JDBC spec, http://java.sun.com/products/jdbc/download.html. From the JDBC spec 3.0 API Table B3 " Mapping from JDBC types to Java Object Types" . JDBC type Java Object type ------------------------------------------ INTEGER Integer In this case we are register the JDBC type to be of type java.sql.Integer, by using registerOutParameter(1, java.sql.Types.INTEGER). So, the 9014, 92 is the correct behavior. The old behavior (8i to 9013) was violating the jdbc 3.0 spec and the new behvior is the correct one as required by J2EE CTS (JAVA Certification Suite for J2EE complient), for that reason Oracle integrated a set of changes on their 22.214.171.124 version of the driver and above. Please note that JDBC 9013 can still be used with 920X database. As this configuration was done for our iAS product. As a result I had to remove the following call: dataSet.setBigDecimal(primaryKeyName,sequenceGeneratorQueryDataSet.getBigDecimal("SEQ_NUM")); and replace it with : Statement stmt; Connection conn = sTEPDataModule.getDatabase().getJdbcConnection(); stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "select "+sequenceGeneratorName+".nextval SEQ_NUM from dual"); rs.next(); dataSet.setBigDecimal(primaryKeyName,rs.getBigDecimal(1)); This seems to work with no problems.