You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mark Shifman <ma...@yale.edu> on 2009/05/01 20:23:22 UTC
[commons-dbutils] Commons DbUtils 1.2 problem with QueryRunner
Hi:
I just downloaded the new release, dropped the jar into an app and I am getting
java.sql.SQLException: Unsupported feature Query:
My database is oracle 10g and I am using the ojdbc14.jar. Everything worked just fine
with an old commons-dbutils-1.1.jar.
My simple program did this:
final String sql = "select * from p_user where user_id=?";
Map m = null;
try {
QueryRunner run = new QueryRunner(getDataSource());
m = (Map)run.query(sql,"60", new MapHandler());
} catch (SQLException ex) {
ex.printStackTrace();
}
System.out.println(m);
and threw this:
java.sql.SQLException: Unsupported feature Query: select * from p_user where user_id=? Parameters: [60]
at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:540)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:397)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:486)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:443)
at org.ycmi.ypedBilling.Billing.printtest1(Billing.java:270)
at org.ycmi.ypedBilling.Billing.test1(Billing.java:96)
at org.ycmi.ypedBilling.Billing.main(Billing.java:42)
I also tried public QueryRunner(DataSource ds, boolean pmdKnownBroken) with pmdKnownBroken=true and false and I
got the same exception.
Has something else changed or is something broken with the new version and oracle?
Thanks in advance:
mas
--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
mark.shifman@yale.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [commons-dbutils] Commons DbUtils 1.2 problem with QueryRunner
Posted by Mark Shifman <ma...@yale.edu>.
After fooling around a bit it looks like
ParameterMetaData pmd = stmt.getParameterMetaData();
in public void fillStatement(PreparedStatement stmt, Object[] params)
is what is causing the exception.
Exception in thread "main" java.sql.SQLException: Unsupported feature
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:690)
at oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData(OraclePreparedStatement.java:4421)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:223)
This was added (from annotated source)
> 171 : bayard 747724
> 172 : ParameterMetaData pmd = stmt.getParameterMetaData();
> 173 : if (pmd.getParameterCount() < params.length) {
> 174 : throw new SQLException("Too many parameters: expected "
> 175 : + pmd.getParameterCount() + ", was given " + params.length);
> 176 : }
This seems to be an Oracle problem. After googleing a variety of folks seem to have this problem in different applications.
I just found a newer jar ojdbc5.jar which ameliorated the problem. But the above lines could break a lot of oracle code using the older ojdbc14.jar.
Perhaps it could be removed or conditionally run like code below it in fileStatement.
mas
Mark Shifman wrote:
> Hi:
> I just downloaded the new release, dropped the jar into an app and I am getting
> java.sql.SQLException: Unsupported feature Query:
>
> My database is oracle 10g and I am using the ojdbc14.jar. Everything worked just fine
> with an old commons-dbutils-1.1.jar.
>
> My simple program did this:
>
> final String sql = "select * from p_user where user_id=?";
> Map m = null;
> try {
> QueryRunner run = new QueryRunner(getDataSource());
> m = (Map)run.query(sql,"60", new MapHandler());
> } catch (SQLException ex) {
> ex.printStackTrace();
> }
> System.out.println(m);
> and threw this:
> java.sql.SQLException: Unsupported feature Query: select * from p_user where user_id=? Parameters: [60]
> at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:540)
> at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:397)
> at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:486)
> at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:443)
> at org.ycmi.ypedBilling.Billing.printtest1(Billing.java:270)
> at org.ycmi.ypedBilling.Billing.test1(Billing.java:96)
> at org.ycmi.ypedBilling.Billing.main(Billing.java:42)
>
> I also tried public QueryRunner(DataSource ds, boolean pmdKnownBroken) with pmdKnownBroken=true and false and I
> got the same exception.
>
> Has something else changed or is something broken with the new version and oracle?
> Thanks in advance:
> mas
>
--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
mark.shifman@yale.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org