Re: Connection reset on MS JDBC driver

From: Andy Fish (ajfish_at_blueyonder.co.uk)
Date: 02/12/04

  • Next message: Silvio Bierman: "Re: Connection reset on MS JDBC driver"
    Date: Thu, 12 Feb 2004 19:19:55 GMT
    
    

    "Silvio Bierman" <sbierman@idfix.nl> wrote in message
    news:OwDx1jZ8DHA.4060@tk2msftngp13.phx.gbl...
    >
    > "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    > news:c925c3dc.0402120636.46c141c4@posting.google.com...
    > > Hi,
    > >
    > > I have a problem with the MS JDBC driver whereby when I try to use a
    > > connection after a long time idle it reports:
    > >
    > > [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer
    > >
    > > I've read plenty discussion on the subject and am convinced that
    > > rather than trying to stop sockets from ever being closed, I need to
    > > detect and re-open the connection.
    > >
    > > I can't afford to rejig all the database code to detect this exception
    > > and retry so I want to have my home made connection pool test the
    > > connection before giving it out.
    > >
    > > My question is, is there a way of pinging the server through JDBC to
    > > see if the physical connection is still alive? If I have to do a SQL
    > > command, what would be a good example of something that is guaranteed
    > > to get through to the server but not take up too much processing or
    > > network?
    > >
    > > it seems to be accepted that any good connection pool should have this
    > > feature - so if anyone knows how they do it I would like to know.
    > >
    > > many thanks for any suggestions
    > >
    > > Andy
    >
    > That is possible but can be quite expensive. Why not keep a last-used
    > timestamp with the connections in the pool and refresh connections when
    they
    > are about to be taken from the pool and are older than some treshold. This
    > approach works great in our long-running server applications.
    >
    > Silvio Bierman
    >
    >

    Thanks, I think I will use this approach.

    FWIW I am doing a 'select @@spid' command to test if the server is still
    there

    Andy


  • Next message: Silvio Bierman: "Re: Connection reset on MS JDBC driver"

    Relevant Pages

    • Re: Connection refusals
      ... The fact that the server is calling out to other code could certainly lead ... Remember if the client (the ASP ... reuse the connection but has to create another. ... However in my experience filling the connection pool ...
      (microsoft.public.sqlserver.connect)
    • Re: Connection timeout
      ... The Connection Pool is a mechanism on the CLIENT, not the server. ... "Timeout expired. ...
      (microsoft.public.dotnet.framework.adonet)
    • Re: Connection Pool in SQLserver 2005
      ... If the users are constantly in/out of the server, ... using connection pooling. ... through all layers all the way into the sqlserver. ... the sqlserver connection pool cannot be used...If ...
      (microsoft.public.sqlserver.connect)
    • Re: ASP.NET SQL Processes
      ... client application which made between the client and server. ... when we use the ADO.NET's connection ... Here is another msdn reference describing the .NET's connection pool ... | SQL server doesn't keep any processes attached to the application. ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Connection reset on MS JDBC driver
      ... > detect and re-open the connection. ... is there a way of pinging the server through JDBC to ... > it seems to be accepted that any good connection pool should have this ...
      (comp.lang.java.databases)