【发布时间】:2017-07-02 10:27:36
【问题描述】:
我在Mysql 中创建了一个数据库;和一个jsp页面中的论坛来验证收到的数据但是我遇到了一个问题,我不知道原因
error :message 在第 24 行处理 JSP 页面 /massar.jsp 时发生异常
代码:
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/massar";
String user = "root";
String password = "!!!!";
String sql = "select massar_profil from massar.massar_user";
try {
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
%>
'
【问题讨论】:
-
请编辑帖子以使其可读。引用的错误是关于:“massar.jsp at line 24”。没有人看到它怎么能提供帮助?
-
第 24 行是:Class.forName(driverName).newInstance();
-
我不知道怎么把所有的代码都放上去,因为太长了
-
非常好。不建议发布所有代码。发帖minimal reproducible example
-
'连接 con= null; PreparedStatement ps = null;结果集 rs = null; String driverName = "com.mysql.jdbc.Driver";字符串 url = "jdbc:mysql://localhost:3306/massar";字符串用户=“根”;字符串密码 = "!!!"; String sql = "从massar.massar_user中选择massar_profil";尝试 { Class.forName(driverName).newInstance(); con = DriverManager.getConnection(url, 用户, 密码); ps = con.prepareStatement(sql); rs = ps.executeQuery();'