public class gethello extends HttpServlet { static final String connect_string = "jdbc:oracle:thin:@127.0.0.1:1521:XE";
static final String uid = "";
static final String pwd = "";
static {
try {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("找不到jdbc驱动");
}
} public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html;charset=gb2312");
PrintWriter out = res.getWriter();
try {
Connection dbconn = DriverManager.getConnection(connect_string,uid,pwd);
dbconn.setAutoCommit(false);
Statement stmt = dbconn.createStatement();
//String dbsql = req.getParameter("DBSQL");
ResultSet dbrest = stmt.executeQuery("select * from employee");
CachedRowSet crs = new CachedRowSetImpl();
==============================================================================================
在crs.populate(dbrest)之前都能执行,但是到了这一句就不行了。我查了很多资料,都是这样些的。不知道他们是怎么能
运行的。跪求解决方法,解我疑惑
================================================================================================
crs.populate(dbrest);
out.println("<tr>");
out.println("</td>input test3" + "<td>");
out.println("</tr>");
dbrest.close();
stmt.close();
dbconn.close();
res.setContentType("application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream(res.getOutputStream());
oos.writeObject(crs);
oos.close();
} catch (Exception exp) {
exp.printStackTrace();
}
}
static final String uid = "";
static final String pwd = "";
static {
try {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("找不到jdbc驱动");
}
} public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html;charset=gb2312");
PrintWriter out = res.getWriter();
try {
Connection dbconn = DriverManager.getConnection(connect_string,uid,pwd);
dbconn.setAutoCommit(false);
Statement stmt = dbconn.createStatement();
//String dbsql = req.getParameter("DBSQL");
ResultSet dbrest = stmt.executeQuery("select * from employee");
CachedRowSet crs = new CachedRowSetImpl();
==============================================================================================
在crs.populate(dbrest)之前都能执行,但是到了这一句就不行了。我查了很多资料,都是这样些的。不知道他们是怎么能
运行的。跪求解决方法,解我疑惑
================================================================================================
crs.populate(dbrest);
out.println("<tr>");
out.println("</td>input test3" + "<td>");
out.println("</tr>");
dbrest.close();
stmt.close();
dbconn.close();
res.setContentType("application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream(res.getOutputStream());
oos.writeObject(crs);
oos.close();
} catch (Exception exp) {
exp.printStackTrace();
}
}
解决方案 »
- JSF 2.0 自定义组件 不执行
- tomcat配置
- jsp模板页的问题,急!急!急!
- webwork.configuration.xml.reload=true 无效
- 大家好,请教关于JBOSS 部署发布的问题
- 求助spring+struts+hibernate异常,我初学者,大家帮下,现谢拉~!
- 小弟请教:在Tomcat中部署Spring时为什么始终说找不到ApplicationContext.xml文件!
- 大家好。我做。NET也两年了。。现在想转JAVA不知道怎么样?这样做明智吗?请大家说说吧。。
- 请问 JVM 是什么 ,它与JDK有什么区别?
- 配tomcat数据连接池的时候出现这样的错误,太邪门了!!!!
- MVC模式和j2ee三层架构之间的关系是什么?
- 动态树的删除问题,急,在线等!!!!
java.lang.UnsupportedOperationException: Not supported yet.
Bean.PagePartition.populate(PagePartition.java:100)