aspose file tools*
The moose likes JDBC and the fly likes The application requester cannot establish the connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "The application requester cannot establish the connection" Watch "The application requester cannot establish the connection" New topic
Author

The application requester cannot establish the connection

Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Hello!

Good day!

My program is supposed to generate an XML and to get its contents it needs to access AS400.
I'm using Eclipse as IDE. During testing, the XML is valid when I run the program in Debug Mode.
Using Run As Java application, the results were inconsistent. Sometimes its valid, sometimes its not.
When the XML is invalid, I notice that this is the error it gets:

java.sql.SQLException: The application requester cannot establish the connection.(Address already in use: connect)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:480)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:2742)
at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:807)
at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:698)
at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.amkor.oasn.dao.JDBCConnectionFactory.getIseriesConnection(JDBCConnectionFactory.java:90)
at com.amkor.oasn.dao.BaseDAO.getIseriesonnection(BaseDAO.java:59)
at com.amkor.oasn.dao.CS2OASND3DAO.getBinDetails(CS2OASND3DAO.java:306)
at com.amkor.oasn.mapping.OASNMapping.createDetail3(OASNMapping.java:1093)
at com.amkor.oasn.mapping.OASNMapping.createDetail2(OASNMapping.java:783)
at com.amkor.oasn.mapping.OASNMapping.createDetail(OASNMapping.java:725)
at com.amkor.oasn.mapping.OASNMapping.OASN(OASNMapping.java:604)user EBIZUSR


What do I need to modify? I think this needs some optimization in the connection.
Can anyone give me an idea on how to implement it?


Thanks,

Darren
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

Are you sure its happening when invalid xml is used ? Because, the error you are getting is because the connection is not properly closed. You need to close the connection as well as the resultset and statement in the finally clause.



Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Thanks for the reply.

The XML becomes invalid because some parts is missing. I have looked at the output in the console and I saw that after the connection has not been established, the next error would say, that details in the XML cannot be created. Though the XML has been generated, there are missing data on it.

As per the proper closure of the connection, yes is it close properly everytime.
What I can see is that there are many instances wherein it is connecting.
Is it proper to connect everytime or its much better if you just connect in the
start of the program and close it before it finishes?

Thanks again.
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

Its a bad way to connect each time. its much better if you just connect in the start of the program and close it before it finishes.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: The application requester cannot establish the connection