db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Force condition: ERROR 08000: Connection closed by unknown interrupt
Date Thu, 20 Oct 2011 15:25:26 GMT
"Phil Bradley" <philb@tower.ie> writes:

>> 
>> Please bear with me, I do not understand the following paragraph:
>> > At the moment, this doesn't address the problem. Specifically, even
>> > after taking these steps, the exception gets thrown after every database
>> > operation.
>> When I read that sentence, I get the impression that the 08000 exception 
>> is being thrown on every JDBC call. Is that right?
>
> Yes, that's correct. The issue is that I cannot force the 08000
> condition but once it occurs, every JDBC call subsequent to that fails
> until the application is restarted. Note that I've never experienced any
> data corruption due to this, just problems with the connection;
> restarting the application has always resolved it.

Maybe the thread's interrupt flag is still on? Derby doesn't clear the
flag when it detects that it has been interrupted, so if you retry
database operations in the same thread after receiving this exception, I
think you'll continue to see that the operations are being interrupted
until you clear the flag, for example by calling Thread.interrupted().

> There's every possibility that there is a problem with the application
> code; it's certainly a little more convoluted that it should be and I'm
> trying to reduce the complexity bit by bit. For the moment though, my
> issue is not with the 08000 error per se, it's that I have no way to
> verify that the error handling that is invoked in response to the 08000
> actually works. 

Maybe you can get it to fail by manually interrupting the thread before
doing some db operations. The following code fails with a 08000 error on
the rs.next() call in my environment:

Thread.currentThread().interrupt();
Connection c = DriverManager.getConnection("jdbc:derby:memory:db;create=true");
Statement s = c.createStatement();
ResultSet rs = s.executeQuery("select * from sysibm.sysdummy1");
rs.next();

-- 
Knut Anders

Mime
View raw message