java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用loc
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/20 17:06:31
![java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用loc](/uploads/image/z/12814213-13-3.jpg?t=java.sql.SQLException%3A+Listener+refused+the+connection+with+the+following+error%3A+ORA-12505%2C+TNS%3A%E6%9C%8D%E5%8A%A1%E9%87%8C%E9%9D%A2%E7%9A%84OracleServiceORCL%E5%92%8COracleOraDb11g_home1TNSListener%E9%83%BD%E6%89%93%E5%BC%80%E4%BA%86%2CLISTENER.ORA%E4%B8%8B%E9%9D%A2%E7%9A%84%EF%BC%88HOST%3Dzhangyang%EF%BC%89%E4%B9%9F%E6%94%B9%E6%88%90%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%90%8D%E4%BA%86%2C%E6%B2%A1%E7%94%A8loc)
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用loc
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:
服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用localhost,还是报异常,求教!
Class.forName("oracle.jdbc.driver.OracleDriver");
\x09\x09} catch (ClassNotFoundException e) {
\x09\x09\x09// TODO Auto-generated catch block
\x09\x09\x09e.printStackTrace();
\x09\x09}
\x09\x09try {
\x09\x09\x09conn=DriverManager.getConnection("jdbc:oracle:thin:@zhangyang:1521:Admin","zhangpeng","zhangpeng");
\x09\x09\x09System.out.println("数据库连接成功3");
\x09\x09} catch (SQLException e) {
\x09\x09\x09// TODO Auto-generated catch block
\x09\x09\x09e.printStackTrace();
\x09\x09\x09
\x09\x09\x09\x09conn.close();
\x09\x09\x09\x09System.out.println("数据库关闭成功3");
\x09\x09\x09} catch (SQLException e) {
\x09\x09\x09\x09// TODO Auto-generated catch block
\x09\x09\x09\x09e.printStackTrace();
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用loc
监听器确认lsnrctl status是否正常
Java代码里的连接字符串是否和服务器一致、尤其是数据库SID名