java - Oracle Database connection attempt, The Network Adapter could not establish the connection -
what i've tried far: -pinging server server. successful -made the database , listener , running on port 1521
one thing confused no example code whatsoever makes mention including password server itself. mention database password. doubt im suppose download oracle software on computer(client), please let me know if i'm wrong.
here's code. btw im using 12c database
import java.sql.drivermanager; import java.sql.connection; import java.sql.sqlexception; public class oracletest { public static void main(string[] args) { system.out.println("-------- oracle jdbc connection testing ------"); try { class.forname("oracle.jdbc.driver.oracledriver"); } catch (classnotfoundexception e) { system.out.println("where oracle jdbc driver?"); e.printstacktrace(); return; } system.out.println("oracle jdbc driver registered!"); connection connection = null; try { connection = drivermanager.getconnection( "jdbc:oracle:thin:@11.111.1.1:1521:sid", "schema", "password"); } catch (sqlexception e) { system.out.println("connection failed! check output console"); e.printstacktrace(); return; } if (connection != null) { system.out.println("you made it, take control database now!"); } else { system.out.println("failed make connection!"); } } }
here exact errors:
-------- oracle jdbc connection testing ------ oracle jdbc driver registered! connection failed! check output console java.sql.sqlrecoverableexception: io error: network adapter not establish connection @ oracle.jdbc.driver.t4cconnection.logon(t4cconnection.java:743) @ oracle.jdbc.driver.physicalconnection.connect(physicalconnection.java:666) @ oracle.jdbc.driver.t4cdriverextension.getconnection(t4cdriverextension.java:32) @ oracle.jdbc.driver.oracledriver.connect(oracledriver.java:566) @ java.sql.drivermanager.getconnection(unknown source) @ java.sql.drivermanager.getconnection(unknown source) @ oracletest.main(oracletest.java:30) caused by: oracle.net.ns.netexception: network adapter not establish connection @ oracle.net.nt.connstrategy.execute(connstrategy.java:470) @ oracle.net.resolver.addrresolution.resolveandexecute(addrresolution.java:506) @ oracle.net.ns.nsprotocol.establishconnection(nsprotocol.java:595) @ oracle.net.ns.nsprotocol.connect(nsprotocol.java:230) @ oracle.jdbc.driver.t4cconnection.connect(t4cconnection.java:1452) @ oracle.jdbc.driver.t4cconnection.logon(t4cconnection.java:496) ... 6 more caused by: java.net.connectexception: connection timed out: connect @ java.net.dualstackplainsocketimpl.waitforconnect(native method) @ java.net.dualstackplainsocketimpl.socketconnect(unknown source) @ java.net.abstractplainsocketimpl.doconnect(unknown source) @ java.net.abstractplainsocketimpl.connecttoaddress(unknown source) @ java.net.abstractplainsocketimpl.connect(unknown source) @ java.net.plainsocketimpl.connect(unknown source) @ java.net.sockssocketimpl.connect(unknown source) @ java.net.socket.connect(unknown source) @ oracle.net.nt.tcpntadapter.connect(tcpntadapter.java:161) @ oracle.net.nt.connoption.connect(connoption.java:159) @ oracle.net.nt.connstrategy.execute(connstrategy.java:428) ... 11 more
Comments
Post a Comment