DB2 ERRORCODE=-4499, SQLSTATE=08001

This error is generated randomly, based on the number of applications running.  If I start up 25 applications, they run creat.  If I open up 10 applications they run great.  If I try to open anothe application an hour later, this message is generated.

Tue Jun 30 14:36:35 EDT 2009 DRIVERFOUND.
Tue Jun 30 14:36:35 EDT 2009 Connecting to database URL = jdbc:db2://10.20.1.125
:50000/EdiMain
a1.1com.ibm.db2.jcc.DB2Driver@5ac072
Tue Jun 30 14:36:35 EDT 2009 Failed to connect, reason :
com.ibm.db2.jcc.a.pm: [jcc][t4][2043][11550][4.0.100] Exception java.net.BindExc
eption: Error opening socket to server /10.20.1.125 on port 50,000 with message:
 Address already in use: connect. ERRORCODE=-4499, SQLSTATE=08001
java.lang.NullPointerException
        at edi2.EDIMain.mycarrierAppStart(EDIMain.java:472)
        at edi2.EDIMain.carrierAppStart(EDIMain.java:293)
        at ANTHEMBCBSMO.ANTHEMBCBSMOMain.main(ANTHEMBCBSMOMain.java:38)
 Exceptionnull
Job is terminated    :
Exception in thread "main" java.lang.NullPointerException
        at java.io.DataOutputStream.writeBytes(Unknown Source)
        at edi2.JobDetails.fileOutputStream(JobDetails.java:99)
        at edi2.JobDetails.appendToFile(JobDetails.java:91)
        at edi2.EDIMain.carrierAppStart(EDIMain.java:328)
        at ANTHEMBCBSMO.ANTHEMBCBSMOMain.main(ANTHEMBCBSMOMain.java:38)
iamtheiamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iamtheiamAuthor Commented:
HEre is the line that it seems to stop at

Statement stmt = conn.createStatement();

My guess is that it can't create a connection to the DB.  If that's the case, what DB2 config settings should I be looking to remedy this?
0
momi_sabagCommented:
are you releasing the connections once your done with them?
0
Kerem ERSOYPresidentCommented:
Hi,

It seesm to me that you're using connection pooling and the applicationc leave DB connections open. So that your DB2 driver is connected to the database.

You can use netstat -an to see if there are any connections to the port 50000 of the hoswt with the IP address of 10.20.1.125.

On what platform you're running this application ?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

iamtheiamAuthor Commented:
the connections "Should" be released when we are done with them.  I am running XP SP3.

Netstat -a -n reveals that I have 204 TCP connections to port 50000
0
Kerem ERSOYPresidentCommented:
How are you connected to the DB?= are you connecting directly or are you using something like Hibernate? Because it seems that you ghave some connection pooling mechanism. If ths is the case edit the .war / .aer to limit connections to say 5 for each system so that you will have room for additional applications.
0
Kent OlsenData Warehouse Architect / DBACommented:
Hi iamtheiam,

A connection isn't really a wire with a switch on yet.  Just because the program ends doesn't mean that the driver and/or server knows that the program has ended and that the connection should be terminated.

Make sure that your application does a connection.close() when it ends.

You can also check the connections on the DB2 side with the command:

  db2 list applications


Good Luck,
Kent
0
iamtheiamAuthor Commented:
Tried running db2 list applications and received a message saying the the maximum number of client applications has been exceeded.  I ran the configuration advisor for the DB and requested 400 local connections and 100 remote connections. Applied t he changes and restarted db2.  Max Agents went from 200 to 509 along with some other configuration changes.  Let's see what happens.
0
Kent OlsenData Warehouse Architect / DBACommented:
Hi iamtheiam,

That sounds like a temporary 'fix'.  You're increasing the number of connections, but if the connection from the driver isn't being dropped, all you're really doing is delaying the inevitable.

But if it buys you some time, great!


Kent
0
Kerem ERSOYPresidentCommented:
This is not a proper way to do. Since your application does not close database connections properliy before terminating. There are connections stay open to your database. So they accumulate and it reaches a point that db2 won't be accepting any more connections.


The best way to avoid the situation is to close all database connections before terminating the application. so I believe you need to modify your program to properly close all db connections before quitting. This is the only viable solution for the time being.

I am still suspecting that your application connects to database through hibernate. So it seems that your application does not close hibernate connections or attempts to reuse and when it starts it opens new connections regardless of the DB connection state. It might be a good idea to check for DB conenction first and attempt to open new connections it if this operation fails.

Cheers,
K.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iamtheiamAuthor Commented:
the # of connections has not increasing past 238.  As the apps go through the process, the number of connections are flexing as needed.  At this time we are going to go through and see why we have 27 applications running, but 200+ db2 connections.  We have 2 DB's that are constantly being connected to. What code I have looked at we are closing the connection when finished.  
0
Kent OlsenData Warehouse Architect / DBACommented:

Make sure that the code doesn't "skip" the call to close() when an error or unforseen event occurs.


Kent
0
iamtheiamAuthor Commented:
We do have some code that connects to DB using Hibernate.  This may be the reason.  The hibernate piece was developed by a third party.  I will investigate.
0
iamtheiamAuthor Commented:
I split the points between Kdo and Keremf.  We are going to make sure that the close statements are reachable and adjust the Hibernate code to close the connections when complete.

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB2

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.