首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java相关 >

关于oracle11g的JDBC有关问题,

2012-08-15 
关于oracle11g的JDBC问题,急刚装了个oracle11g,然后尝试连接,没想到连接失败,错误代码如下:Listener refus

关于oracle11g的JDBC问题,急
刚装了个oracle11g,然后尝试连接,没想到连接失败,错误代码如下:
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:
localhost:1521:oracle

程序中方法如下:

Java code
public static Connection getConnection() {        Connection conn = null;        String driver ="oracle.jdbc.driver.OracleDriver";         String url = "jdbc:oracle:thin:@localhost:1521:oracle";        String uName = "scott";        String pswd = "tiger";        try {            Class.forName(driver);            conn = DriverManager.getConnection(url, uName, pswd);        } catch (ClassNotFoundException e) {            System.out.println("类加载错误"+e.getMessage());        } catch (SQLException e) {            System.out.println("连接错误"+e.getMessage());            e.printStackTrace();        }                return conn;            }


请问下是哪里出了问题啊,急

[解决办法]
oracle监听启动了吗?1521端口通吗?

热点排行