Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
S Shehab
Ranch Hand
Posts: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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..
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that would make sense.
 
S Shehab
Ranch Hand
Posts: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , but i want to know what is the root cause for this problem ?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 491
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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 ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!