这是我的连接代码:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1512:orcl","scott","tiger");
Statement stmt=conn.createStatement();String sql="select * from tb_group";ResultSet result=stmt.executeQuery(sql);
out.println("连接成功!");
%>
</body>
</html>
错误是:
org.apache.jasper.JasperException: An exception occurred processing JSP page /oracle.jsp at line 129: <body>
10: <%
11: Class.forName("oracle.jdbc.driver.OracleDriver");
12: Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1512:orcl","scott","tiger");
13: Statement stmt=conn.createStatement();
14: 
15: String sql="select * from tb_group";
请大家帮我看看,驱动包是不是没有问题了,是连接的问题吗?
说我的第十二行 Connection conn=DriverManager.getConnection有问题

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【huihui28】截止到2008-07-12 16:54:45的历史汇总数据(不包括此帖):
    发帖的总数量:3                        发帖的总分数:60                       每贴平均分数:20                       
    回帖的总数量:1                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:1                        结贴的总分数:20                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:2                        未结的总分数:40                       
    结贴的百分比:33.33 %               结分的百分比:33.33 %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主该结一些帖子了
      

  2.   

    改过来后出现如下错误:
    org.apache.jasper.JasperException: javax.servlet.ServletException: 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:orcllisener.ora文件如下
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc)
          (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
          (PROGRAM = extproc)
        )
      )还有一个LISENER.ORA
     SID_LIST_LISTENER=
    #   (SID_LIST=
    # (SID_DESC=
    # #BEQUEATH CONFIG
    #          (GLOBAL_DBNAME=salesdb.mycompany)
    #          (SID_NAME=sid1)
    #          (ORACLE_HOME=/private/app/oracle/product/8.0.3)
    # #PRESPAWN CONFIG
    #         (PRESPAWN_MAX=20)
    #   (PRESPAWN_LIST=
    #           (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
    #         )
    #        )
    #       )
    很糊涂,怎么有两个同名的文件,内容还不同,要改SID_NAME吗?改成orcl也不成啊,请高手指教
      

  3.   

    看看你的Oracle服务,就知道了sid
      

  4.   

    你的"jdbc:oracle:thin:@localhost:1512:orcl中orcl,你安装的时候是写的这个吗,在服务里查查看