Ok, It can be public.
Idea to "hidde" connection in static method is not very good. It is better
to implement some class with instance methods
and "ConnectionFactory" in constructor and delegate sql execution to
dbutils. I always map connetion/transaction to Thread
it works very good for me in two tier web applications with MVC, I use
"closeIfOpen()" in single place per application
and transaction per request. It is good for JMS applications too,
"dispacher" handles all messages, invokes listeners,
commits transactions (if started) closes connection (if open).


>
> I'm happy to make this public in the current development version of
> dbutils. This is partly because I believe any unreleased software has the
> right to go and utterly change it in the future, so the users are
> accepting that risk [not as if forking a private version of dbutils is
> going to be stunningly painful to manage if need be]. [ie, no backwards
> compatibility worries until a first alpha, and even then not major worries
> until the 1.0 release].
>
> What do you think Juozas?
>
> Additionally, my vote is for having the Connection parameter at the front
> there and not hidden in thread locals. It complicates things I think to do
> otherwise.
>
> Hen
>
> On 21 Feb 2003, george stewart wrote:
>
> > Hi,
> >
> > Could the developers elaborate on reasons for having package access to
the interface ResultSetHandler?
> >
> > If this was public, user's could create objects without using the object
arrays.
> > If it ever becomes public, it would be nice to have something like this
in the package:
> >
> >
> >     static void executeQuery(Connection connection, String query,
> >                                Object[] vals, ResultSetHandler rsh,
> >                                Collection cln
> >                                ) throws SQLException
> >     {
> >
> >         PreparedStatement stmt = null;
> >         ResultSet rs = null;
> >
> >         try {
> >
> >             stmt = connection.prepareStatement(query);
> >             fillStatement(stmt, vals);
> >
> >             try{
> >                 rs = stmt.executeQuery();
> >                 while (rs.next()) {
> >                     cln.add(rsh.handle(rs));
> >                 }
> >
> >             }catch(SQLException sqle){
> >                 String msg = sqle.getMessage() + " in query " + query +
> >                     java.util.Arrays.asList(vals).toString();
> >                 SQLException e = new SQLException(msg);
> >                 e.setNextException(sqle);
> >                 throw e;
> >             }
> >
> >         } finally {
> >             closeQuietly(rs);
> >             closeQuietly(stmt);
> >         }
> >
> >     }
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to