Hi,
This is not a problem with the DataContext per se, but rather with the
underlying javax.sql.DataSource. If the DataSource knows how to
reconnect, DataContext can still be reused. Now, since different JDBC
drivers handle dropped connections differently, Cayenne doesn't handle
all of them. Oracle is handled pretty well, MySQL has a "reconnect"
feature:
http://objectstyle.org/cayenne/faq/deploy.html#reconnect
Now what are your options with Sybase.. There are other DataSource
implementations that have advanced reconnect feature. E.g. Jakarta
commons-dbcp - http://jakarta.apache.org/commons/dbcp/ . You can use
them with Cayenne.
1. If you are deploying in a web container like Tomcat, you can map a
shared DBCP DataSource per Tomcat documentation, and use a
JNDIDataSourceFactory configured here:
http://objectstyle.org/cayenne/modelerguide/common-tasks/create-data-
node.html
2. If you run a standalone application, you can write your own factory
class that implements org.objectstyle.cayenne.conf.DataSourceFactory
and instantiates DBCP pool. We would gladly accept such factory as a
contribution to Cayenne :-).
Andrus
On Feb 11, 2004, at 9:27 AM, Vassilis Raxenidis wrote:
> Hi,
>
> I use cayenne together with Sybase.
> If the network goes down while trying to execute a query (for example
> by
> calling performIteratedQuery of DataContext)
> then the following exception is thrown:
> org.objectstyle.cayenne.CayenneException: [v.1.0.2 October 27 2003]
> Error
> getting ResultIterator: Global Exception:
> java.sql.SQLException: Can't obtain connection. Request timed out.
> So far so good as the databse server can't be reached due to network
> connection problem.
> But when the network connection to database server is recovered any
> subsequent call of performIteratedQuery method on the same
> DataContext instance keeps on throwing the same exception. Is that
> logical?
> Is there any recovery actions that have to be taken on the DataContext
> object after a network connectivity problem is detected?
> Thanks in advance.
>
> Vassilis Raxenidis
This archive was generated by hypermail 2.0.0 : Wed Feb 11 2004 - 12:14:22 EST