Solved

DB2 ERRORCODE=-4499, SQLSTATE=08001

Posted on 2009-06-30
13
46,516 Views
Last Modified: 2012-05-07
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)
0
Comment
Question by:iamtheiam
  • 6
  • 3
  • 3
  • +1
13 Comments
 

Author Comment

by:iamtheiam
ID: 24748377
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
 
LVL 37

Expert Comment

by:momi_sabag
ID: 24748484
are you releasing the connections once your done with them?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24748913
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
 

Author Comment

by:iamtheiam
ID: 24749620
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
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24749863
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
 
LVL 45

Expert Comment

by:Kdo
ID: 24753610
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:iamtheiam
ID: 24754002
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
 
LVL 45

Expert Comment

by:Kdo
ID: 24754034
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
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 125 total points
ID: 24754248
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
 

Author Comment

by:iamtheiam
ID: 24754298
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
 
LVL 45

Assisted Solution

by:Kdo
Kdo earned 125 total points
ID: 24754327

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


Kent
0
 

Author Comment

by:iamtheiam
ID: 24754399
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
 

Author Closing Comment

by:iamtheiam
ID: 31598480
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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

18 Experts available now in Live!

Get 1:1 Help Now