Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

The application requester cannot establish the connection

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic