Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

what if the database goes down?

2 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-08-13 07:28:57.0Z
Loren Will Posted on 1997-08-06 22:24:21.0Z
Message-ID: <33E8F995.F7D41DF1@uclink4.berkeley.edu>
Date: Wed, 06 Aug 1997 15:24:21 -0700
From: Loren Will <lwill@uclink4.berkeley.edu>
X-Mailer: Mozilla 4.01 [en] (Win95; I)
MIME-Version: 1.0
Subject: what if the database goes down?
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 49
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:400
Article PK: 252152

I am writing a multi-threaded program that is constantly recieving
temperature data that I am storing in a database, but I want to
safegaurd against the possibility that the database goes down and then
losing the data coming in so I want to write the data to a local file in
the event of a database connection problem. I am opening 5 connections
to the database using jConnect when the program starts, and the problem
I am having is how I can tell if, and when, the connections go bad.
It seems that as soon as any connection goes down I should get a
SQLException whenever trying to execute a SQL statement (and then I
could run a utility thread to verify that the connection is down using
isClosed() on one of the connections, and if the connection is indeed
bad change a flag to indicate data should now be written to file instead
of to the database then have the thread loop around until it can to
re-establish the 5 connections).
However, when I try to simulate a downed server by unplugging my
ethernet connection all the threads seem to wait for about 30 seconds
without any exception being thrown, and if I plug the cable back in
within those 30 seconds the program will continue as if nothing has
happened. However if I wait a while longer then an exception seems to
be thrown but when I try to re-establish the connections I can't get the
old connections working again. Could you outline (or tell me where I
can find) the process that jConnect goes through when one of its open
connections can no longer access the database, because although my
SQLException handling utility function may need improving, I can find
nothing in any of my codes that would account for everything pausing for
half a minute when the cable gets unplugged. And also, if you know of a
good scheme to use in determining and handling when a downed server
occurs I would be very grateful.

-thanks,
Loren


David Clegg Posted on 1997-08-13 07:28:57.0Z
Message-ID: <33F16239.44E00033@sybase.com>
Date: Wed, 13 Aug 1997 00:28:57 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 3.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: Loren Will <lwill@uclink4.berkeley.edu>
Subject: Re: what if the database goes down?
References: <33E8F995.F7D41DF1@uclink4.berkeley.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 89
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:380
Article PK: 252132

The "feature" where jConnect does not correctly indicate when
a connection has been closed from the network side is jConnect
bug # 131136.

I've just submitted a fix for that bug for review and hope to have
it rolled into a new release later this week. The modified behavior
will be that once a connection has been lost, you will receive
1 SQLException with the IOException that jConnect saw from the
network as its message body - then any further attempts to do something
with the connection will raise more SQLException (Connection closed),
and the 'isClosed()' method will return true.

The 30 second delay when unplugging your ethernet cable is really
more of a O/S timeout issue than anything.

I'm working on a version of the jConnect driver that would tunnel
TDS through HTTP connections through a gateway. One of the side-effects
of this approach would be that you could lose your network connection
(longer than 30 seconds) and then if at some time later you were able
to get back on-line, your connection would still be good (assuming
that the gateway that you are HTTP/TDS tunnelling through is still
up and running). I'd be interested to hear whether this approach
is appealing to you with your current application - and what sorts
of tuning parameters would seem relevant here (timeouts on the
gateway for closing connections when the clients have been idle for
a while, how long/many times to retry establishing a connection to
the gateway if the client loses connectivity, etc.)

dave

> I am writing a multi-threaded program that is constantly recieving
> temperature data that I am storing in a database, but I want to
> safegaurd against the possibility that the database goes down and then
> losing the data coming in so I want to write the data to a local file in
> the event of a database connection problem. I am opening 5 connections
> to the database using jConnect when the program starts, and the problem
> I am having is how I can tell if, and when, the connections go bad.
> It seems that as soon as any connection goes down I should get a
> SQLException whenever trying to execute a SQL statement (and then I
> could run a utility thread to verify that the connection is down using
> isClosed() on one of the connections, and if the connection is indeed
> bad change a flag to indicate data should now be written to file instead
> of to the database then have the thread loop around until it can to
> re-establish the 5 connections).
> However, when I try to simulate a downed server by unplugging my
> ethernet connection all the threads seem to wait for about 30 seconds
> without any exception being thrown, and if I plug the cable back in
> within those 30 seconds the program will continue as if nothing has
> happened. However if I wait a while longer then an exception seems to
> be thrown but when I try to re-establish the connections I can't get the
> old connections working again. Could you outline (or tell me where I
> can find) the process that jConnect goes through when one of its open
> connections can no longer access the database, because although my
> SQLException handling utility function may need improving, I can find
> nothing in any of my codes that would account for everything pausing for
> half a minute when the cable gets unplugged. And also, if you know of a
> good scheme to use in determining and handling when a downed server
> occurs I would be very grateful.
>
> -thanks,
> Loren