• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error

 
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm using in my Java code ,DB connection pooling in GlassFish server 3.1.2 to connect to SQL server , it works fine , but after a while i got this error :


when i restart the server it works fine again , i can't understand what is causing this error , and i need a way to make sure that the connection returned back to the pool successfully..
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your application's connection handling code look like? If you are using datasource(s) what does the configuration look like?
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:What does your application's connection handling code look like? If you are using datasource(s) what does the configuration look like?



this the code for getting a connection fomr the pool


after using the connection i close it :


find attached the pool configurations
Untitled.jpg
[Thumbnail for Untitled.jpg]
pool configs
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idle timeout configuration in that screenshot looks suspicious. If you let the connection stay idle in the pool for a long time then the DB side of the connection can be terminated (the DB admins usually set a connection timeout). When the pool then hands out such an idle (and terminated connection) you can run into exceptions like these.

Make sure you set some reasonable value for idle timeout for the pooled connections.

 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:The idle timeout configuration in that screenshot looks suspicious. If you let the connection stay idle in the pool for a long time then the DB side of the connection can be terminated (the DB admins usually set a connection timeout). When the pool then hands out such an idle (and terminated connection) you can run into exceptions like these.

Make sure you set some reasonable value for idle timeout for the pooled connections.


what is the recommended timeout value , or this depends on the DB server ?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It usually depends on the DB admin policies. You'll have to check with whoever manages your DB server.
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:It usually depends on the DB admin policies. You'll have to check with whoever manages your DB server.


i checked with them they told me the timeout is 10 mins , so do you think i should make it less than that in the pool ?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that would make sense.
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks , but i want to know what is the root cause for this problem ?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sherif Shehab wrote:Thanks , but i want to know what is the root cause for this problem ?



I already explained the potential problem in one of my previous posts in this very thread.
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:

Sherif Shehab wrote:Thanks , but i want to know what is the root cause for this problem ?



I already explained the potential problem in one of my previous posts in this very thread.


is this the only reason ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic