java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:服务里面的OracleServiceORCL和OracleOraDb11g_home1TNSListener都打开了,LISTENER.ORA下面的(HOST=zhangyang)也改成计算机名了,没用loc

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 04:18:49
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)也改成计算机名了,没用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名