jsp报错,An exception occurred processing JSP page /user_add.jsp at line 129 Statement ps = conn.createStatement(); 你先确定下 conn对象是否为空 还有怎么没见LZ 加载数据库驱动啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我写了另一个CLASS那时有连接数据库方法。package com.drp.jdbc.util;import java.sql.*;public class JdbcBean{ public static void main(String[] args){ JdbcBean.getConnection(); } static{ try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("ClassNotFoundException"); e.printStackTrace(); } } public static Connection getConnection(){ Connection conn = null; try{ conn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.106:1521:orcl", "system", "admin"); }catch(SQLException e){ System.out.println(e+"======out"); } return conn; } public static Statement getStatment(Connection conn){ Statement stmt = null; try { stmt = conn.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return stmt; } public static ResultSet getResultSet(Statement stmt){ ResultSet rs = null; try { rs = stmt.executeQuery("select * from t_user"); } catch (SQLException e) { e.printStackTrace(); } return rs; } public static void closeConn(Connection conn){ if(conn!=null){ try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } conn=null; } public static void closeResultSet(ResultSet rs){ if(rs!=null){ try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } rs=null; } public static void closePreparedStatement(PreparedStatement ps){ if(ps!=null){ try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } } ps=null; }} 又有新错误了, org.apache.jasper.JasperException: java.lang.NullPointerException ssh集成dwr问题2!! 新安装的myeclipse8.5没有Myeclipse java Enterprise 桥连 请问大家可用分怎样才能赚到啊? jspSmartUpload不用浏览文件上传 高分!applet的怎么调整大小,来适应浏览器窗口的尺寸 找不到action,在线等待 紧急 求回复 请问在jsp或者servlet中有没有相当于java script中的window.open()的函数呢? apache下可不可以使用servlet!? Tomcat运行JNI出现Internal Error java查看作业号
import java.sql.*;
public class JdbcBean{
public static void main(String[] args){
JdbcBean.getConnection();
}
static{ try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundException");
e.printStackTrace();
} }
public static Connection getConnection(){
Connection conn = null;
try{
conn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.106:1521:orcl", "system", "admin");
}catch(SQLException e){
System.out.println(e+"======out");
} return conn;
}
public static Statement getStatment(Connection conn){
Statement stmt = null;
try {
stmt = conn.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
return stmt;
}
public static ResultSet getResultSet(Statement stmt){
ResultSet rs = null;
try {
rs = stmt.executeQuery("select * from t_user");
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
}
public static void closeConn(Connection conn){
if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
conn=null;
}
public static void closeResultSet(ResultSet rs){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
rs=null;
}
public static void closePreparedStatement(PreparedStatement ps){
if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
ps=null;
}
}