You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Dan Fabulich <da...@fabulich.com> on 2009/05/01 17:37:21 UTC

[ANNOUNCEMENT] Commons DbUtils 1.2 released

The Commons DbUtils team is pleased to announce the commons-dbutils-1.2 release!

DbUtils is a package of Java utility classes for easing JDBC development.

Source and binary distributions are available for download from the Apache 
Commons download site:

http://commons.apache.org/downloads/download_dbutils.cgi

When downloading, please verify signatures using the KEYS file available 
at the above location when downloading the release.

For more information on Apache Commons DbUtils, visit the Commons DbUtils 
home page:

http://commons.apache.org/dbutils/

Changes in this version include:

Compatibility warnings:

o API change in QueryRunner: the setDataSource method was removed in order
to fix a thread-safety bug (DBUTILS-52)
o We upgraded the JVM dependency from JDK 1.3 to JDK 1.4 (DBUTILS-31)
o Users who may have extended BeanListHandler.handleRow will find that
this method no longer exists (is no longer called) in DbUtils 1.2
(DBUTILS-37)
o Users who may have extended KeyedHandler will find that its protected
members are now final (to guarantee thread safety). (DBUTILS-51)

Fixed Bugs:
o fillStatement setNull bug with the Postgres/Derby JDBC driver (and others)  Issue: DBUTILS-31. 
o NullPointerException occured at rethrow method  Issue: DBUTILS-40. 
o Add serialVersionUID to BasicRowProcessor.CaseInsensitiveHashMap  Issue: DBUTILS-36.

Changes:
o Removed setDataSource method to guarantee thread safety  Issue: DBUTILS-52. 
o Made numerous private instance members final to guarantee thread safety; changed protected member of KeyedHandler to final  Issue: DBUTILS-51. 
o Support bean property to SQL IN parameter mapping  Issue: DBUTILS-29. 
o Make GenericListHandler (now AbstractListHandler) public  Issue: DBUTILS-33. 
o BasicRowProcessor loses any information on database field case  Issue: DBUTILS-34. 
o BeanListHandler#handle(ResultSet) is not optimal  Issue: DBUTILS-37. 
o Object with Long or Decimal got initial zero value while database field is null  Issue: DBUTILS-42. 
o example documentation page, update query  Issue: DBUTILS-38.

Removed:
o Remove old Maven1/Ant build scripts

Have fun!
-Commons DbUtils team


---------------------------------------------------------------------
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


[commons-dbutils] Commons DbUtils 1.2 problem with QueryRunner

Posted by Mark Shifman <ma...@yale.edu>.
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