java.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:lisjava.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:listener does not currently know of SID given in connect desc

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 20:30:36
java.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:lisjava.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:listener does not currently know of SID given in connect desc

java.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:lisjava.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:listener does not currently know of SID given in connect desc
java.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:lis
java.sql.SQLException:Listener refused the connection with the following error:
ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by:oracle.net.ns.NetException:Listener refused the connection with the following error:
ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
...25 more

java.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:lisjava.sql.SQLException:Listener refused the connection with the following error:ORA-12505,TNS:listener does not currently know of SID given in connect desc
这是因为oracle 服务没有建好.可以在菜单net manager打开 新建一个服务.然后用这个服务登录.

计算机软件的知识
数据库异常 监听拒绝这个连接 显错

找到这个目前下。
D:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
用记事本打开 listener.ora 文件;文件如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)...

全部展开

找到这个目前下。
D:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
用记事本打开 listener.ora 文件;文件如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0HRTOR4KLCB9KTG)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
最后我在 eclipse 把SID 修改成最后那两位数:XE
代码如下:
public class testjdbc {
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:xe";
String user = "XXX";
String password = "XXX";
Connection con=DriverManager.getConnection(url, user, password);
System.out.println(con);
}
}
最后运行结果:oracle.jdbc.driver.T4CConnection@1813fac

收起

这是计算机数据库问题,翻译成中文也没用,可以到计算机数据库分类里提问。java与数据库连接问题。jdbc提供了java与数据库的连接方法,具体问题还是找数据库专家提问吧

服务器连接问题,因该是服务没有开启吧,你先把服务重新启动,试试