my dog learned polymorphism*
The moose likes JDBC and the fly likes JDBC Driver: Connection reset by peer: socket write error - ms-sqlserver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Driver: Connection reset by peer: socket write error - ms-sqlserver " Watch "JDBC Driver: Connection reset by peer: socket write error - ms-sqlserver " New topic
Author

JDBC Driver: Connection reset by peer: socket write error - ms-sqlserver

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Hi Friends,

Here my problem is "java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]System Exception: Connection reset by peer: socket write error".

I'm receiving the above error from my application. ( i.e )my application is communicating with Sql Server continously, and there is no request for a long time from my application to SqlServer and if i tried any request to Sql Server. im getting this error.


I just want to know, is the problem is from Sql Server side or from my application.

Whatever it is please help me to solve this. I couldn't able to reproduce this problem.


Creativity is nothing but Breaking Rules
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"Connection reset by peer" means the SQL Server instance itself deliberately closed yopur connection. There are a number of reasons this could happen depending on what your application is doing:

  • The SQL Server instance may have been stopped
  • The connection has timed out
  • In the case of binary data, the stream is reset.


  • It sounds like the second reason is the most likely. My guess is you open a connection and leave it open doing nothing, is this the case?


    JavaRanch FAQ HowToAskQuestionsOnJavaRanch
    santhosh.R gowda
    Ranch Hand

    Joined: Apr 06, 2009
    Posts: 296


    Is there any change i had to made to overcome this problem....so please let me know
    Paul Sturrock
    Bartender

    Joined: Apr 14, 2004
    Posts: 10336

    I don't think it is your DataSource definition that is the problem. Do you always close connections? Has the database server been restarted? Look in the SQL Server logs, it should tell you what caused the server to decide to drop the connection.
    santhosh.R gowda
    Ranch Hand

    Joined: Apr 06, 2009
    Posts: 296
    But here in log file of Data Base im not getting any error details
    santhosh.R gowda
    Ranch Hand

    Joined: Apr 06, 2009
    Posts: 296
    hi Paul
    I 'm getting the same error after three days .so when i restart my tomcat it is working fine but .im not getting why this is going to be happining and i observed that if no request came to my tomcat for 2 days then it will give this error..
    and i had also increased

    in my server.xml file so kindly help in overcome this problem
    Jan Cumps
    Bartender

    Joined: Dec 20, 2006
    Posts: 2495
        
        8

    Can you use the validationquery functionallity of your connection pool? It will validate connections before giving them to you, and discards and recreates stale connections.

    Regards, Jan


    OCUP UML fundamental and ITIL foundation
    youtube channel
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JDBC Driver: Connection reset by peer: socket write error - ms-sqlserver