连接数据库的时候出现 ORA-12518, TNS错误

Johnsonwlf 2006-12-03 07:01:00
我用的是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
...全文
275 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Johnsonwlf 2006-12-07
  • 打赏
  • 举报
回复
重新建个数据库来用就好了 嘿嘿
Johnsonwlf 2006-12-05
  • 打赏
  • 举报
回复
上面那句话取消.
用String url = "jdbc:oracle:thin:@john:1521:orcl";
错误是:
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:
john:1521:orcl
貌似url没错了,还是会出现同样的错误:无法分发客户端连接
Johnsonwlf 2006-12-04
  • 打赏
  • 举报
回复
用String url = "jdbc:oracle:thin:@john:1521:orcl";会出现错误:指定了无效的 Oracle URL

所以我自作主张 把@改成: (我知道8i9i是写@的 因为我用的是10g的)
反而没提示url无效
awusoft 2006-12-03
  • 打赏
  • 举报
回复
如果可以,记得结贴哦..
awusoft 2006-12-03
  • 打赏
  • 举报
回复
少那一个@吧???String url = "jdbc:oracle:thin:@john:1521:orcl";
a175017191 2006-12-03
  • 打赏
  • 举报
回复
String url = "jdbc:oracle:thin:john:1521:john";
你试试可以吗

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧