Oracle 데이터베이스 OJDBC에 연결하는 데 큰 어려움이 있습니다.GWT - Oracle JDBC 연결 문제
Error:
". : I/O 오류 : 데이터베이스 예외 메시지에 연결할 수 없습니다 네트워크 어댑터 연결을 구축 할 수 없습니다"구글 웹 툴킷 (Google Web Toolkit)를 사용하여
미안하고 내가 SQL 데이터베이스에 추가 내 프로젝트에.
데이터베이스 이름은 의제입니다.
나는 많은 것을 수색했는데,이 문제는 많은 사람들에게 공통적이지만,이 문제를 극복하지 못했습니다. "ojdbc6.jar"을 다운로드하고 BUILDPATH에 추가했습니다.
새로 고침하고 닫았다가 다시 열었지만 오류가 계속 표시됩니다.
내 사양 :
윈도우 7 64
스프링 소스는 - 사람이 올바른 방향으로 날 지점 수
private static final long serialVersionUID = 1L;
private Connection connection = null;
private Properties props = null;
private ClassLoader cl = null;
private String databaseURL = "";
private String databaseUser = "";
private String databasePass = "";
public void init() {
try {
// Load the database connection properties from com.gwt.agenda.GWTAgendaSample.properties
props = new Properties();
cl = this.getClass().getClassLoader();
InputStream is = cl.getResourceAsStream("com/gwt/agenda/GWTAgendaSample.properties");
props.load(is);
// Load the database access information
databaseURL = props.getProperty("databaseURL");
databaseUser = props.getProperty("databaseUser");
databasePass = props.getProperty("databasePass");
} catch (Exception e) {
e.printStackTrace();
logger.error("Error loading GWTAgendaSample.properties file.", e);
}
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
// Connect to the database
connection = DriverManager.getConnection(databaseURL, databaseUser, databasePass);
} catch (SQLException se) { messageOut = "Unable to connect to database. Exception message: " + se.getMessage();
System.out.println(messageOut);
se.printStackTrace();
// Server side log
logger.error(messageOut + "\n", se);
destroy();
} catch (Exception e) {
messageOut = "Unable to connect to database. Exception message: " + e.getMessage();
System.out.println(messageOut);
e.printStackTrace();
// Server side
logger.error(messageOut + "\n", e);
destroy();
}
}
이클립스
도 시도했다. 내가 누락 된 것이 있습니까?도와주세요!
편집 됨 !! 내 DB URL이 심하게 문제의 드라이버 형식 또는 사용자 이름과 암호가 잘못되거나 잘못 전달되는 경우
Unable to connect to database. Exception message: Erro de E/S: The Network Adapter could not establish the connection
java.sql.SQLRecoverableException: Erro de E/S: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
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 com.gwt.Agenda.server.GreetingServiceImpl.init(GreetingServiceImpl.java:78)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:342)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 27 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:209)
at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
... 32 more
Unable to connect to database. Exception message: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
연결 URL이 무엇입니까? –
databaseURL = jdbc : oracle : thin : @ hp-PC : 1521 : Agenda databaseUser = user databasePass = agenda 여기서 @ hp-PC는 내 컴퓨터 이름이고 Agenda는 데이터베이스 이름입니다. – Martinho
은 오라클 리스너입니다. –