我用的是oracle 10g,主机名为john,监听接口为1521.数据库名为oracletest,
sid为orcl
java代码:
String url = "jdbc:oracle:thin:john:1521:orcl";
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url, "sysman", "123");
帮我看看有没有写错?
错误: Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
localhost:1521:orcl
------解决方法--------------------------------------------------------
试试这个
String url = "jdbc:oracle:thin:@john:1521:orcl";
------解决方法--------------------------------------------------------
确认sqlplus连接的正确性。把主机名换成ip地址44看
------解决方法--------------------------------------------------------
你在 sqlplus 里可以正确连接吗?
不行就重启你的oracle 服务
------解决方法--------------------------------------------------------
jdbc:oracle:thin:@10.25.10.175:1526:stg
------解决方法--------------------------------------------------------
方法2:String url = "jdbc:oracle:thin:sysman/123@localhost:orcl";
conn = DriverManager.getConnection(url);
注意:检查 TNS listener服务是否启动,或者重新配置一下