Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:15:18+00:00 2026-05-11T08:15:18+00:00

My team built a Windows Service in Java that connects to a SQL Server

  • 0

My team built a Windows Service in Java that connects to a SQL Server 2005 in a Windows 2003 Server, using pure JDBC (no connection pooling) with the JTDS driver.

After a while, the method that opens the connections to the database start raising exceptions with the following stack trace:

    java.net.BindException: Address already in use: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124)  

Although the programmers were careful to close connections when they were done, something is not going right.

For the time being, we solved the problem switching to the Named Pipes protocol (since all is hosted in the same machine), but this is a temporary solution.

I’ve googled for the problem and it seems we should be using some connection pooling library such c3p0. Is this the only solution to the problem?

Could I try to raise the sockets limit in Windows 2003?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:15:19+00:00Added an answer on May 11, 2026 at 8:15 am

    Are you opening / closing connections at a very rapid rate? When a TCP connection is closed, they hang around for a little while in the TIME_WAIT state. On Windows, the default time they exist is 240 seconds. It sounds like you might have quite a few tcp connections in the TIME_WAIT state.

    You can check this by running netstat. If you have a huge number of tcp connections to the database server in the TIME_WAIT state, a connection pool will fix your issue.

    You can try to raise the socket limit, and/or lower the time a connection will stay in the TIME_WAIT state. But this will alter the behavior of all tcp connections. So use a connection pool 🙂 We use dbcp as our connection pool solution in Java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, you need to specify the classpath using the -classpath… May 16, 2026 at 3:52 pm
  • Editorial Team
    Editorial Team added an answer It's by design. Just create another session. If the Session… May 16, 2026 at 3:52 pm
  • Editorial Team
    Editorial Team added an answer You can prevent DoS attacks from occuring in various ways.… May 16, 2026 at 3:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm running Microsoft Team Foundation Server 2010, and using it to build a .NET
I'm trying to install Team Build (2008) on a different Build Server (BS) to
I have a msdeploy in my nant script(Team City) that is working except it
I have tried compiling the service EXE file as AnyCPU, x86, and x64. It
I am invoking dotfuscator task via TFS Build a.k.a Team Build , taken from
I've been brought in as an intern to develop a SharePoint site. My team
Is there a Win32 function I can call to show a Windows login dialog?
I am in the process of evaluating an upgrade to Windows SDK 7.1 Part
I am trying to build an application to help our marketing team manage a
I have an application that I'm developing in Visual Studio 2010 that utilizes a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.