import java.sql.*;
public class testJDBC {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection a=DriverManager.getConnection
("jdbc:oracle:thin:@192.168.1.2:1521:bjspdgis","xukai","123456");
}
}
这是我测试连接Oracle数据库的代码,但不知道为什么总是报错如下:
Exception in thread "main" 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:
192.168.1.2:1521:bjspdgis
我不明白,bjspdgis因该是数据库对外提供服务的名字吧,但是如何查看我自己数据库的这个名字啊?见笑了,本人菜鸟一个,哪位大虾耐心讲解一下。
public class testJDBC {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection a=DriverManager.getConnection
("jdbc:oracle:thin:@192.168.1.2:1521:bjspdgis","xukai","123456");
}
}
这是我测试连接Oracle数据库的代码,但不知道为什么总是报错如下:
Exception in thread "main" 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:
192.168.1.2:1521:bjspdgis
我不明白,bjspdgis因该是数据库对外提供服务的名字吧,但是如何查看我自己数据库的这个名字啊?见笑了,本人菜鸟一个,哪位大虾耐心讲解一下。
解决方案 »
- 在ArrayList中存放的字符串数组为什么自动清空了?
- 请问运行时报错“需要<标识符>”是什么错误
- 请教:Vista U +IE8,安装了j6u9,发现本机html里的脚本在IE无反应,远程的东东或ff却好好的
- java的布局问题
- java ftp上传测试,请高手帮忙
- : 连上了数据库,就是插入不了数据
- 用File类时可不可以用相对路径
- 为什么HelloWorld没有显示?
- java线程怎么调用java的application.class?
- java调用oracle存储过程的简单问题
- oracle里的sequence谁会~~~
- JBUTTON本身已经设置成透明,我想让加在JBUTTON里的图片的背景也透明,要如何做到?请帮忙解决下,感激不尽!
楼主【sky_pacer_2008】截止到2008-07-08 20:49:53的历史汇总数据(不包括此帖):
发帖的总数量:0 发帖的总分数:0 每贴平均分数:0
回帖的总数量:0 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:---------------------结分的百分比:---------------------
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html