Solved

[microsoft][sqlserver 2000 driver for jdbc]Error establishing socket

Posted on 2006-11-22
10
214 Views
Last Modified: 2010-04-01
Hi all,

My JSP application is using MS SQL 2000 as the Database.
I keep on getting this issue "[microsoft][sqlserver 2000 driver for jdbc]Error establishing socket" after running my application for a while. Is it caused by the depleted number of SQL sockets available? May I know how many available sockets are there in MS SQL 2000 before it starts to stop releasing?
Please let me know if I'm not making any sense here, thanks.
0
Comment
Question by:rospcc
  • 4
  • 2
10 Comments
 
LVL 5

Expert Comment

by:deeppra
ID: 17994686
may be all the sockets will be occupied ... so release the sockets so that other connections can be established
0
 

Author Comment

by:rospcc
ID: 17994719
deeppra, Do you know how to release those sockets?
0
 
LVL 5

Expert Comment

by:deeppra
ID: 17994754
send me the code so that i can tell u
u can close the open sockets using con.close() function where con is a Connection object
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 10

Expert Comment

by:mbvvsatish
ID: 17995055
you may not be closing or releasing the connections in your code as pointed by deeppra
you need to close the connections in the finally block
try{
......
}catch(){
....
}finally {
   if(rs!=null)
   { rs.close(); }
   if(statement!=null)
   { statement.close(); }
   if (con !=null)
   {con.close();}
}
it will be better if you use connection pool, so that you can set the max connections in the pool.
0
 
LVL 5

Expert Comment

by:deeppra
ID: 17995104
not only u have to close the connection in the finally block... after u done all the things then u have to close the connection

try {
//connect to database
//some query
//do some work
//close the connection like this
con.close();
}catch(){
....
}finally {
   if(rs!=null)
   { rs.close(); }
   if(statement!=null)
   { statement.close(); }
   if (con !=null)
   {con.close();}
}
0
 
LVL 10

Accepted Solution

by:
mbvvsatish earned 500 total points
ID: 17995217
>>not only u have to close the connection in the finally block... after u done all the things then u have to close the connection

what make you to think so. I dont think it is required. if you close/release the connection in finally block that's enough.
0
 
LVL 5

Expert Comment

by:deeppra
ID: 17995221
okay fine
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now