我用的是tomcat服务器,昨天还能连上的oracal数据库,今天连不上了,我保证我的lisenter和orcl都已经启动了!!帮帮忙吧!!千恩万谢!!!
下面是一个我连接的一个小例子
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%><%!
String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
String DBURL = "jdbc:oracle:thin:@localhost:1521:ORCL" ;
String DBUSER = "system" ;
String DBPASSWORD = "fuwei" ;
Connection conn = null ;
Statement stmt = null ;
%>
<%
try
{
Class.forName(DBDRIVER) ;

conn = DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD) ;

String sql = "CREATE TABLE fuweitab (name varchar(20))" ;
stmt = conn.createStatement() ;
stmt.executeUpdate(sql) ;
stmt.close() ;
conn.close() ;
}
catch(Exception e)
{
out.println(e) ;
}
%>
出现的错误如下,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: localhost:1521:ORCL 

解决方案 »

  1.   

    ntly know of SID given in connect descriptor 看来是 SID 错了。你再次看看你启动的TSN 是不是 ORCL的 TNS
      

  2.   

    你确实SID是ORCL么,你用oracle客户端工具能登的上么
      

  3.   

    能啊 sqlplus么?您指的是?
      

  4.   

    2000 我就建立了orcl那么一个库啊 您说的orcl的tns是什么意思??
      

  5.   

    出的错误的原因是说
    你那连接不可用,被拒绝了,因为已经在使用了
    而竹子的意思是
    http://www.eygle.com/archives/2006/08/oracle_tns_12502.html
    我更倾向于你db的名字可能打错了。