Solved

DB2 ERRORCODE=-4499, SQLSTATE=08001

Posted on 2009-06-30
13
46,282 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
Comment Utility
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
Comment Utility
are you releasing the connections once your done with them?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:iamtheiam
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
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

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

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

16 Experts available now in Live!

Get 1:1 Help Now