Details

Description

We use an Oracle 9i environment and I have recently upgraded from dbutils-1.1-dev.jar (1.1 with a necessary Oracle fix in the previous release) to dbutils 1.2. It appears we are completely dead-in-the-water with the 1.2 release due to all QueryRunner statements blowing up at runtime.

The mentioned workaround is to upgrade from ojdbc14.jar (JDK 1.4+) to ojdbc5.jar (JDK 5.0+) or ojdbc6.jar (JDK 6.0+). I have not yet confirmed if this works, still trying to acquire those later jars and they may be an Oracle 11g only thing (i.e. not compatible with Oracle 9i). I do note that dbutils claims to work with JDK 1.4 and up, so a ojdbc14.jar solution ought to be devised.

It seems that this issue is similar to the one I encountered (as described in DBUTILS-58), in that the Oracle 9i JDBC driver has a incorrect implementation of the ParameterMetaData#getParameterCount() method : it returns 0 instead of returning the number of parameters required for the PreparedStatement.

As yuhl stated, this should be resolved by commenting this code block :

Julien Aymé
added a comment - 22/Oct/09 09:46 It seems that this issue is similar to the one I encountered (as described in DBUTILS-58 ), in that the Oracle 9i JDBC driver has a incorrect implementation of the ParameterMetaData#getParameterCount() method : it returns 0 instead of returning the number of parameters required for the PreparedStatement.
As yuhl stated, this should be resolved by commenting this code block :
if (pmd.getParameterCount() < params.length) {
throw new SQLException( "Too many parameters: expected "
+ pmd.getParameterCount() + ", was given " + params.length);
}

This isn't exactly fixed, but by fixing DBUTILS-58, you can now work around this issue by building your QueryRunner with pmdKnownBroken. I think this is appropriate, because in this case, Oracle's ParameterMetaData is clearly broken.

Dan Fabulich
added a comment - 03/Nov/09 01:51 This isn't exactly fixed, but by fixing DBUTILS-58 , you can now work around this issue by building your QueryRunner with pmdKnownBroken. I think this is appropriate, because in this case, Oracle's ParameterMetaData is clearly broken.