dingli created DBUTILS-122:
------------------------------

             Summary: getParameterMetaData  Exception
                 Key: DBUTILS-122
                 URL: https://issues.apache.org/jira/browse/DBUTILS-122
             Project: Commons DbUtils
          Issue Type: Bug
    Affects Versions: 1.5, 1.6
         Environment: Windows, JDK6
            Reporter: dingli


using ojdbc6.jar to connect to Oracle,  we get "ORA-00942 table or view not 
exist" exception.  after dive into dbutils code, we found  the exception is 
throw from  
org.apache.commons.dbcp.DelegatingPreparedStatement.getParameterMetaData

this is a oracle bug , but dbutils should ignore it and continue processing

in the AbstractQueryRunner.java

method :  fillStatement

if (!pmdKnownBroken) {
            pmd = stmt.getParameterMetaData();
            int stmtCount = pmd.getParameterCount();
            int paramsCount = params == null ? 0 : params.length;

            if (stmtCount != paramsCount) {
                throw new SQLException("Wrong number of parameters: expected "
                        + stmtCount + ", was given " + paramsCount);
            }
        }

the code should catch the exception and set pmdKnownBroken to true and continue


another suggestion:
can the AbstractQueryRunner provide a method to set pmdKnownBroken in addtion 
to constructor ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to