While running the my application i am getting the exception as shown below , actually the application has to get the some data from oracle db for fetchning the data ,as i am newbie please anyone help it out on this how i need to resolve ,its very urgent:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Ok So you are using both Oracle and MySQL.
Are you able to connect to MySQL through your program?
Please check if you are using the right drivers for Oracle?
You can also post a small code snippet ,just as to how you are trying to connect. It will be useful for people to help you.
I think it might be a problem connecting to two different datasources using one driver.
Which driver are you using? Can you connect to either of the datasources from your application?
Do you have multiple getConnection() methods returning different DataSource objects from your source?
Joined: Feb 23, 2012
i am connecting the oracle db by using this java class:
and in the same manner i am connecting to the mysql db also ,totally i wrote two java class one for mysql db connection and another for oracle db , actual i earlier i was able to get the data n able to connect but now this type of error i am getting when i checked the log file .
The looks a bit strange. I would definitely change some of those methods to private. The close() for instance. When you call your fetch method, you can create a connection, run your sql, and then close right afterwards.
Normally you should check if the ResultSet, Statement and Connection are null before trying to close them and put it in a finally block. What if your rs.close throws an exception? The st.close() and con.close() are never called.
Have you tried using the oci oracle drivers rather than the thin client?