永发信息网

用MyEclipse连接数据库的问题

答案:2  悬赏:60  手机版
解决时间 2021-07-20 10:00
  • 提问者网友:嘚啵嘚啵
  • 2021-07-19 18:54

我用MyEclipse连接数据库时提示了这样的错误,不知道为什么。

The server encountered an internal error () that prevented it from fulfilling this request.

exception org.apache.jasper.JasperException: Exception in JSP: /WebRoot/JDBC.jsp:5

2: <%@ page import="java.sql.*" %>

3: <%

4:

5: Class.forName("oracle.jdbc.driver.OracleDriver");

6: Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","admin");

7: Statement sm= conn.createStatement();

8: ResultSet rs = sm.executeQuery("select * from dept");

提示是第五行出错?连接的数据库名称也没错啊。但是我数据库也确实连接上了:

最佳答案
  • 五星知识达人网友:梦中风几里
  • 2021-07-19 20:32

你引用了ORACLE的JAR架包了吗?

全部回答
  • 1楼网友:夜余生
  • 2021-07-19 21:35
服务器遇到内部错误( )表示,无法履行这项要求。 org.apache.jasper.jasperexception :无法编译类的JSP : 发生错误行: 3月在JSP的文件: /网页/ specificnews - change.jsp mm_connlzs_driver解决不了的 1 : < % @页的ContentType =的“ text / html ;字符集= gb2312 ”语文= “ Java的”进口= “ java.sql .* ”进口= “ java.sql.drivermanager ” % > 2 : < % 3 :司机driverrenew = (司机) class.forname ( mm_connlzs_driver ) 。 newinstance ( ) ; 4 :连接connrenew = drivermanager.getconnection ( mm_connlzs_string , mm_connlzs_username , mm_connlzs_password ) ; 5 : preparedstatement statementrenew = connrenew.preparestatement ( “选择*从tnews那里fsubjectid = '1 '秩序fdate的ASC ” ) ; 6 : ResultSet中更新= statementrenew.executequery ( ) ;发生错误行:四在JSP的文件: /网页/ specificnews - change.jsp mm_connlzs_string解决不了的 1 : < % @页的ContentType =的“ text / html ;字符集= gb2312 ”语文= “ Java的”进口= “ java.sql .* ”进口= “ java.sql.drivermanager ” % > 2 : < % 3 :司机driverrenew = (司机) class.forname ( mm_connlzs_driver ) 。 newinstance ( ) ; 4 :连接connrenew = drivermanager.getconnection ( mm_connlzs_string , mm_connlzs_username , mm_connlzs_password ) ; 5 : preparedstatement statementrenew = connrenew.preparestatement ( “选择*从tnews那里fsubjectid = '1 '秩序fdate的ASC ” ) ; 6 : ResultSet中更新= statementrenew.executequery ( ) ; 7 :布尔renew_isempty = ! renew.next ( ) ; 发生错误行:四在JSP的文件: /网页/ specificnews - change.jsp mm_connlzs_username解决不了的 1 : < % @页的ContentType =的“ text / html ;字符集= gb2312 ”语文= “ Java的”进口= “ java.sql .* ”进口= “ java.sql.drivermanager ” % > 2 : < % 3 :司机driverrenew = (司机) class.forname ( mm_connlzs_driver ) 。 newinstance ( ) ; 4 :连接connrenew = drivermanager.getconnection ( mm_connlzs_string , mm_connlzs_username , mm_connlzs_password ) ; 5 : preparedstatement statementrenew = connrenew.preparestatement ( “选择*从tnews那里fsubjectid = '1 '秩序fdate的ASC ” ) ; 6 : ResultSet中更新= statementrenew.executequery ( ) ; 7 :布尔renew_isempty = ! renew.next ( ) ; 发生错误行:四在JSP的文件: /网页/ specificnews - change.jsp mm_connlzs_password解决不了的 1 : < % @页的ContentType =的“ text / html ;字符集= gb2312 ”语文= “ Java的”进口= “ java.sql .* ”进口= “ java.sql.drivermanager ” % > 2 : < % 3 :司机driverrenew = (司机) class.forname ( mm_connlzs_driver ) 。 newinstance ( ) ; 4 :连接connrenew = drivermanager.getconnection ( mm_connlzs_string , mm_connlzs_username , mm_connlzs_password ) ; 5 : preparedstatement statementrenew = connrenew.preparestatement ( “选择*从tnews那里fsubjectid = '1 '秩序fdate的ASC ” ) ; 6 : ResultSet中更新= statementrenew.executequery ( ) ; 7 :布尔renew_isempty = ! renew.next ( ) ;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯