You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by eladio <el...@caritos.com> on 2003/12/12 21:35:16 UTC

[DbUtils] - Constructing QueryRunner Instance using java.sqlConection parameter

The example found in
http://jakarta.apache.org/commons/dbutils/examples.html statest that you
can configure QueryRunner with a DataSourse as well as a Database
Connection.

I can not find how that is down looking at the constructor methods.  Only
found 2, one with no arguments, the other with a datasource.


Text from example page:

 Explanation

   1. Configure QueryRunner with the DataSource. Note that QueryRunner has
methods that take a java.sql.Connection so you are not required to use
DataSources.
   2. Implement the ResultSetHandler interface or use one of the provided
implementations. This one converts a ResultSet row into a bean.
   3. Execute the SQL statement with one replacement parameter and return
the results in a new Person object (generated by the handler in step 2).




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


Re: [DbUtils] - Constructing QueryRunner Instance using java.sqlConection parameter

Posted by David Graham <gr...@yahoo.com>.
If you're using the raw Connection, you have to pass it into
QueryRunner.query().

David


--- eladio <el...@caritos.com> wrote:
> The example found in
> http://jakarta.apache.org/commons/dbutils/examples.html statest that you
> can configure QueryRunner with a DataSourse as well as a Database
> Connection.
> 
> I can not find how that is down looking at the constructor methods. 
> Only
> found 2, one with no arguments, the other with a datasource.
> 
> 
> Text from example page:
> 
>  Explanation
> 
>    1. Configure QueryRunner with the DataSource. Note that QueryRunner
> has
> methods that take a java.sql.Connection so you are not required to use
> DataSources.
>    2. Implement the ResultSetHandler interface or use one of the
> provided
> implementations. This one converts a ResultSet row into a bean.
>    3. Execute the SQL statement with one replacement parameter and
> return
> the results in a new Person object (generated by the handler in step 2).
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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