分类: Java
2008-03-14 10:29:02
author: smalldog
今天夜晚本人总结Java连接Oracle的学习经验如下:
在使用Oracle
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
这样的异常错误,说明Oracle的监听程序 OracleOraDb
OracleServiceORCL 没有打开,此程序在”服务”中能找到,应将其启动。
若启动监听程序后又出现如下一些异常:
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
The Connection descriptor used by
the client was:
127.0.0.1:1521:orcl
我们应将自己所使用的开发工具关掉,然后重新启动就没有问题啦。
另外的问题就是细节啦:
像URL字符串的书写:jdbc:oracle:thin:@127.0.0.1:1521:orcl
1521是Oracle默认提供的端口号
orcl是Oracle对外提供服务的默认实例名(在安装时可以自己修改)
其余的只要自己仔细点就行啦。
请各位帮我把这点小经验发表
以帮助那些需要的人
谢谢!