• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The application requester cannot establish the connection

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic