commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raffaele Spazzoli <rspazz...@imolinfo.it>
Subject feature addition proposal: disconnected jdbc statement
Date Fri, 18 Nov 2005 15:35:50 GMT
Hi,

I've developed a class library to allow use of jdbc statements
(Statement, PreparedStatement, CallableStatement) in a disconnected
environment (i.e. a situation where a jdbc connection is not available).
This library can be thought as the counterpart of the CachedResultSet
class. I believe this library (about 6 classes) could be hosted in the
common-dbutils project. Please let me know if you are interested.

More in detpth:

Why this library can be useful: I think this library is enough general
to be used is projects outside mine. In my project (an ESB like very
customized for a customer) I have a situation where a mapping between
messages occur faraway from the connection handling. For managing the
case when the connection is of jdbc type I had to develop this library.

The usage pattern is like the following:

Disconnected phase:

      DisconnectedPreparedStatement
statement=DisconnectedStatementFactory.prepareDisconnectedStatement("select * from SYS.SYSTABLES
where TABLETYPE=?");
      statement.setString(1,"S");

connected phase:

      statement.setConnection(conn);
      statement.setConnected(true);
      ResultSet resultset=statement.executeQuery(); 
      statement.setConnected(false);
      conn.close();

disconnected phase:

      log.info("resultset: "+resultset.toString());

It's not possible to call all the statement methods' during the
disconnected phase. Basically callable methods are the ones returning
void. The inner working is that called methods are memorized and called
in the correct sequence when setConnected() is invoked.
Result set returned during the connected phase are all of
CachedResultSet type and thus can be used in a disconnected environment.
Also out parameter of callable statement are handled.


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


Mime
View raw message