Forums Register Login

Not able to connect oracle 11.2 using ODBC6.jar

+Pie Number of slices to send: Send
Hi,

I am trying to connect with oracle 11.2 using odbc6.jar
below is my conenction details.

String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
String JDBC_STRING = "jdbc:oracle:thin:@//CDB:1521/cdb"; // CDB is hostname
String USER_NAME = "USER";
String PASSWD = "pass;
Class.forName (JDBC_DRIVER);
conn = DriverManager.getConnection (JDBC_STRING, USER_NAME, PASSWD);


And i am facing below exeption

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at oracle.ConnectJDBCOracle11g.main(ConnectJDBCOracle11g.java:25)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:392)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:434)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:687)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:247)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 7 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:150)
at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:370)
... 12 more




i am able to connect using sqlplus command

sqlplus USER/pass@//hostname/cdb


I am not able to connect using ip of system in space of hostname.

Any help is greatly appreciated.



+Pie Number of slices to send: Send
Are You sure OS can resolve CDB hostname? In console type "ping cdb" to check if your system knows what ip is assigned to cdb. If system cannot resolve cdb name, you have to insert proper record in /etc/hosts file. Also try tnsping cdb.
+Pie Number of slices to send: Send
 

Patryk Sosinski wrote:... In console type "ping cdb" to check if your system knows what ip is assigned to cdb...


Good advise.

Patryk Sosinski wrote:...Also try tnsping cdb.


Vicky is using the thin driver. That doesn't use TNS.

+Pie Number of slices to send: Send
 

Jan Cumps wrote:
Vicky is using the thin driver. That doesn't use TNS.



True, but connection to sqlplus use TNS (i think), so tnsping maybe give some direction what is wrong (maybe different ip is assigned in TNS and different in etc/hosts)

+Pie Number of slices to send: Send
 

Patryk Sosinski wrote:... In console type "ping cdb" to check if your system knows what ip is assigned to cdb...



Yes my system can ping that.
But your advice help me to sort my problem.
my system was not able to telnet on 1521 port.

Thanks a lot


+Pie Number of slices to send: Send
Your JDBC String value should be "jdbcracle:thin:@//CDB:1521:cdb" in place of "jdbcracle:thin:@//CDB:1521/cdb"
+Pie Number of slices to send: Send
Thank you for joining the Ranch, Anil!

I believe that the original poster used the right connection. What you see there is that the forum translated colon+o into a smiley.



I'm sure glad that he's gone. Now I can read this tiny ad in peace!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 15197 times.
Similar Threads
connection of JDBC with oracle 9i database
JDBC connection issue with RAC database
Spring - Connection Problem in some Unit Tests
SQLException : The Network Adapter could not establish connection
Network adapter connection error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:29:54.