当前位置: 代码迷 >> Java相关 >> 关于oracle11g的JDBC有关问题,
  详细解决方案

关于oracle11g的JDBC有关问题,

热度:8468   发布时间:2013-02-25 21:45:06.0
关于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端口通吗?
  相关解决方案