关于java和Oracle数据库连接的问题。
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因该是数据库对外提供服务的名字吧,但是如何查看我自己数据库的这个名字啊?见笑了,本人菜鸟一个,哪位大虾耐心讲解一下。