[Registry-dev] extensible searching API
Chathura C. Ekanayake
chathura at wso2.com
Thu Sep 13 05:28:40 PDT 2007
There is a problem in returning a ResultSet object in executeQuery(...)
method.
ResultSets cannot be accessed after the jdbc connection used for
retrieving the ResultSet is closed.
AFAIK although we use pooled connections, we can't guarantee that the
connections will not be closed.
Connection pool implementations may close connections after it has
reached some threshold connection count.
The solution for disconnected database result access is CachedRowSet
interface, which is only available in java 1.5.
And even in java 1.5, there is no standard impl of that interface.
I think there are two solutions for this problem.
1) Add a java.sql.Connection object as a parameter to the executeQuery
method. Then the caller of the method is
responsible for closing the connection (or giving the connection back to
the pool).
2) Create an in-memory table to hold the data of the ResultSet and
return it.
Comments ...
Thanks,
Chathura
Sanjiva Weerawarana wrote:
> Here's a proposal for adding extensible searching to the registry:
>
> void defineQuery (String name, String query)
> ResultSet executeQuery (String name, Object[] params)
>
> So one can define a query and then later execute it.
>
> Obviously the person writing the query needs to understand the
> relational data model that we're using; thus effectively we need
> document that as part of the "API" of the registry.
>
> Thoughts?
>
> Sanjiva.
More information about the Registry-dev
mailing list