資源簡介
Java web程序設計任務教程(全書源代碼)黑馬程序員編著
代碼片段和文件信息
package?cn.itcast.chapter10.example;
import?java.sql.Connection;?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?org.apache.commons.dbutils.ResultSetHandler;
?public?class?baseDao?{
? //?優化查詢
? public?static?object?query(String?sql?ResultSetHandler>?rsh?
??????????????object...?params)?throws?SQLException?{
? ????Connection?conn?=?null;
? ????PreparedStatement?pstmt?=?null;
? ????ResultSet?rs?=?null;
? ????try?{
? //?獲得連接
? conn?=?JDBCUtils.getConnection();
? //?預編譯sql
? pstmt?=?conn.prepareStatement(sql);
? //?將參數設置進去
? for?(int?i?=?0;?params?!=?null?&&?i???????????????????{
? pstmt.setobject(i?+?1?params[i]);
? }
? //?發送sql
? rs?=?pstmt.executeQuery();
? //?讓調用者去實現對結果集的處理
? object?obj?=?rsh.handle(rs);
? return?obj;
? }?catch?(Exception?e)?{
? e.printStackTrace();
? }finally?{
? //?釋放資源
? JDBCUtils.release(rs?pstmt?conn);
? ? }
? return?rs;
? }
?}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-02-23?17:08??教材源碼\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\
?????文件????????1257??2016-02-23?15:07??教材源碼\第10章\chapter10\.classpath
?????文件????????1042??2016-02-23?10:10??教材源碼\第10章\chapter10\.project
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\.settings\
?????文件?????????503??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\.jsdtscope
?????文件?????????395??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\org.eclipse.jdt.core.prefs
?????文件?????????455??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\org.eclipse.wst.common.component
?????文件?????????345??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2016-02-23?10:10??教材源碼\第10章\chapter10\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\WebContent\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\WebContent\me
?????文件??????????39??2016-02-23?10:10??教材源碼\第10章\chapter10\WebContent\me
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\WebContent\WEB-INF\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\
?????文件??????610790??2016-01-25?10:35??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\c3p0-0.9.1.2.jar
?????文件??????160519??2016-02-23?10:21??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\commons-dbcp-1.4.jar
?????文件???????77857??2016-02-23?15:07??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\commons-dbutils-1.6.jar
?????文件??????111119??2016-02-23?10:22??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\commons-pool-1.6.jar
?????文件??????540852??2015-12-29?16:02??教材源碼\第10章\chapter10\WebContent\WEB-INF\lib\mysql-connector-java-5.0.8-bin.jar
?????文件?????????714??2016-02-23?10:10??教材源碼\第10章\chapter10\WebContent\WEB-INF\web.xm
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\classes\
?????文件????????1037??2016-02-23?14:12??教材源碼\第10章\chapter10\build\classes\c3p0-config.xm
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\classes\cn\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\classes\cn\itcast\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\classes\cn\itcast\chapter10\
?????目錄???????????0??2019-02-23?17:08??教材源碼\第10章\chapter10\build\classes\cn\itcast\chapter10\example\
?????文件????????2037??2016-02-23?15:10??教材源碼\第10章\chapter10\build\classes\cn\itcast\chapter10\example\ba
............此處省略1456個文件信息
評論
共有 條評論