commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: [DbUtils] 2 Questions
Date Thu, 18 Mar 2004 22:27:46 GMT
1.  Please send the code that calls QueryRunner including any custom
ResultSetHandler implementation you're using.

2. Passing an Integer object is only required to work if the column is
defined as an INTEGER.  Refer to appendix B in the 3.0 JDBC spec for type
mapping info.  As a last resort, you could override
QueryRunner.fillStatement() to work around any bugs in your driver.

David

--- Stefan Edlich <edlich@gmx.net> wrote:
> Dear DbUtils Crew or Users,
> 
> I have 2 perhaps simple questions:
> 
> 1. I have slight problems running the DbUtil Tools from the first
> website
> example.
> No problem occurs when using the BeanHandler as a Result Set Handler
> to get just one bean back. This is well done.
> 
> But the example on the website should return an object array but it
> crashes.
> The result set looks fine but the new ResultSetHandler calls
> rs.getObject(i
> + 1);
> which causes the following exception:
> java.sql.SQLException: No data is available Query: SELECT * FROM Person
> WHERE age=37 Parameters: [
> 	at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:330)
> 	at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:213)
> 	at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:236)
> 	at de.commonsbuch.dbutils.Read2BeanArray.main(Read2BeanArray.java:44)
> I am running hsqldb1.7.1 but the error might be thrown by
> java.sql.ResultSet.getObject
> Any idea what's could be wrong?
> 
> 2. If you like to query for an Integer and you are using replacement
> parameters with this
> query method:
> query(java.sql.Connection conn, java.lang.String sql, java.lang.Object
> param, ResultSetHandler rsh) 
>           Execute an SQL SELECT query with a single replacement
> parameter.
> 
> How do you enter an Integer to search for? (new Integer(37)) won't work.
> 
> Thanks in advance
> Stefan E
> 
> -- 
> <mailto: stefan@edlich.de>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message