commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Edlich" <edl...@gmx.net>
Subject [DbUtils] 2 Questions
Date Thu, 18 Mar 2004 21:50:16 GMT
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


Mime
View raw message