我自己又建了一个数据库实例 全局名称叫panfeng
监听(OracleOraDb11g_home1TNSListener)
和数据库服务(OracleServicePANFENG)都开了
我用这个连接地址报错了(String url = "jdbc:oracle:thin:@localhost:1521:panfeng")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代码
public class BaseDao {
String url = "jdbc:oracle:thin:@localhost:1521:PANFENG"; // 连接字符串
String className = "oracle.jdbc.OracleDriver"; // 驱动
String userName = "pan"; // 用户名
String userPass = "123"; // 用户密码 public Connection getConn() { // 连接
Connection conn = null;
try {
Class.forName(className);
conn = DriverManager.getConnection(url,userName,userPass);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
怎么解决阿..在线等oracle数据库jdbc
监听(OracleOraDb11g_home1TNSListener)
和数据库服务(OracleServicePANFENG)都开了
我用这个连接地址报错了(String url = "jdbc:oracle:thin:@localhost:1521:panfeng")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代码
public class BaseDao {
String url = "jdbc:oracle:thin:@localhost:1521:PANFENG"; // 连接字符串
String className = "oracle.jdbc.OracleDriver"; // 驱动
String userName = "pan"; // 用户名
String userPass = "123"; // 用户密码 public Connection getConn() { // 连接
Connection conn = null;
try {
Class.forName(className);
conn = DriverManager.getConnection(url,userName,userPass);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
怎么解决阿..在线等oracle数据库jdbc
对应的URL为:"jdbc:oracle:thin:@localhost:1521:ORCL"
SID is wrong.