Link to home
Start Free TrialLog in
Avatar of iamtheiam
iamtheiam

asked on

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)
Avatar of iamtheiam
iamtheiam

ASKER

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?
are you releasing the connections once your done with them?
Avatar of Kerem ERSOY
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 ?
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
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.
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
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.
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
ASKER CERTIFIED SOLUTION
Avatar of Kerem ERSOY
Kerem ERSOY

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.  
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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!