jsp分页(oracle+jsp+apache)
一 前提
希望最新的纪录在开头给你的表建立查询:
表:mytable
查询:create or replace view as mytable_view from mytable order by id desc 其中,最好使用序列号create sequence mytable_sequence 来自动增加你的纪录id号
二 源程序
<%String sConn="你的连接"
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(sConn,"你的用户名","密码");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Statement stmtcount=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from mytable_view");
String sqlcount="select count(*) from mytable_view";
ResultSet rscount=stmtcount.executeQuery(sqlcount);
int pageSize=你的每页显示纪录数;
int rowCount=0; //总的记录数
while (rscount
int pageCount; //总的页数
int currPage; //当前页数
String strPage;
strPage=request.getParameter("page");
if (strPage==null){
currPage=1;
}
else{
currPage=Integer.parseInt(strPage);
if (currPage<1) currPage=1;
}
pageCount=(rowCount+pageSize-1)/pageSize;
if (currPage>;pageCount) currPage=pageCount;
int thepage=(currPage-1)*pageSize;
int n=0;
rs.absolute(thepage+1);
while (n<(pageSize)&&!rs
%>;
<%rs.close();
rscount.close();
stmt.close();
stmtcount.close();
conn.close();
%>;
//下面是 第几页等
<form name="sinfo" method="post" action="sbinfo_index.jsp?condition=<%=condition%
相关文档:
(1)oracle数据库备份的导入对数据库的版本有要求,也即源数据库(导出产生备份的数据库)的版本要和目标数据库(导入数据库)的版本一致,否则可能导致导入失败。
(2)备份中的用户名(数据库导出时所使用的用户)和导入数据库的用户名最好一样,因为用户名和表空间命名有关系,如果不一样,导入就不能一次完成。也就是 ......
PL/SQL-FOR UPDATE 与 FOR UPDATE OF的区别
url:http://hi.baidu.com/1413/blog/item/a521251f7e5993c4a686696b.html
数据库 oracle for update of 和 for update区别
select * from TTable1 for update 锁定表的所有行,只能读不能写
2 select * from TTable1 wher ......
本译文采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议发布,转载请保留此信息
译者:马齿苋 | 链接:http://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
作者:Sadequl Hussain | 原文:http://www.sql-server-performance.com/articles/dba/oracle_sql_server_comparison_p1.aspx
一 ......
ServletContext 被 Servlet 程序用来与 Web 容器通信。例如写日志,转发请求。每一个 Web
应用程序含有一个Context,被Web应用内的各个程序共享。因为Context可以用来保存资源并且共享,所以我所知道的
ServletContext 的最大应用是Web缓存----把不经常更改的内容读入内存,所以服务器响应请求的时候就不需要进行慢速的磁 ......