cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC - ORACLE ERROR

SOLVED
Go to solution
Priya A
Occasional Advisor

JDBC - ORACLE ERROR

Hi,
I am new to this discussion and new to oracle as such. I downloaded the oracle9i (trial version) from the oracle website. And after a little struggle, I got oracle running and I was able to query through sqlPlus and JDBC program.
For some reason, oracle did not work suddenly, so i re-installed it and again it works. But now my JDBC is not able to connect to the database.
I am able to connect to the database using sqlplus username developer1 and password developer1. but when i try the following using java:
connection = DriverManager.getConnection
("jdbc:oracle:thin:@marcanthony:1521:dev1","developer1","developer1");

and compile it, i get the following error:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Jdbctest1.main(Jdbctest1.java:21)

Any help?
Thanks.
p
10 REPLIES
Steve Steel
Honored Contributor

Re: JDBC - ORACLE ERROR

Hi

make sure listener.ora hostname is the
same as defined for db connector config


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Priya A
Occasional Advisor

Re: JDBC - ORACLE ERROR

where can I find listener.ora?
and db connector config? It may be very trivial, but I am very new to this. Also, I have atatched my very simple java program that uses JDBC to connect to oracle. I am able to connect to the database and query using sqlplus but not through my program which was working earlier.

Thanks.
-p
Steve Steel
Honored Contributor
Solution

Re: JDBC - ORACLE ERROR

Hi

cd $ORACLE_HOME
find . -name listener.ora

Use same method and documentation to find
other file in ORA and JAVA dir.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor

Re: JDBC - ORACLE ERROR

Hi

Also.check if the network configuration is ok for that machine, maybe there are problems in resolving the host name

steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor

Re: JDBC - ORACLE ERROR

Hi

If you are new

http://www.ifs.uni-linz.ac.at/ifs/teaching/java/sqlj/doc/faq.html

Step By Step trouble shooting.


steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Priya A
Occasional Advisor

Re: JDBC - ORACLE ERROR

I looked at the listener.ora and I have attached the file. I dont see anything wrong.

Thanks for the continuos help
-p
Priya A
Occasional Advisor

Re: JDBC - ORACLE ERROR

The link is exactly what i wanted.. the error:
SQLException: The network adapter could not establish the connection"

is what I am getting and its there in the link. Thanks a million. I shall try as per provided and shall see.

Thanks again.
-p
Priya A
Occasional Advisor

Re: JDBC - ORACLE ERROR

I also often get the message
Enter user-name: developer1
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

when i connect to sqlplus
Priya A
Occasional Advisor

Re: JDBC - ORACLE ERROR

THANKS A MILLION Steve.. I got it working. Thanks a lot.

-p
Steve Steel
Honored Contributor

Re: JDBC - ORACLE ERROR

Points are always nice
If you want truly to understand something, try to change it. (Kurt Lewin)