資源簡介
含有3個版本,分別從簡單到稍微華麗一點,適合初學者,數據庫簡單.可以自己進行修改

代碼片段和文件信息
package?book;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.sql.Statement;
/**
?*?javabean文件
?*?
?*?@author?acer
?*?
?*/
public?class?bk?{
String?sDBDriver?=?“com.mysql.jdbc.Driver“;
//?數據庫的用戶名和密碼
final?String?db_user?=?“root“;
final?String?db_password?=?“123456“;
Connection?conn?=?null;
ResultSet?rs?=?null;
public?ResultSet?executeQuery(String?sql)?{
rs?=?null;
try?{
Class.forName(sDBDriver);
conn?=?DriverManager.getConnection(
“jdbc:mysql://localhost:3306/test“?db_user
db_password);
Statement?stmt?=?conn.createStatement();
//?stmt?=?conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE
//?ResultSet.CONCUR_READ_ONLY);
rs?=?stmt.executeQuery(sql);
System.out.println(“執行到了這里!!!“);
}?catch?(Exception?e)?{
System.err.println(“aq.executeQuery:“?+sql);
}
return?rs;
}
public?void?executeUpdate(String?sql)?{
try?{
Class.forName(sDBDriver);
conn?=?DriverManager.getConnection(
“jdbc:mysql://localhost:3306/webstore“?db_user
db_password);
Statement?stmt?=?conn.createStatement();
stmt.executeUpdate(sql);
System.out.println(“執行到了這里!!!“);
}?catch?(Exception?e)?{
System.err.println(“aq.executeQuery:“?+sql);
}
?
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????833??2011-12-15?19:36??網上書店\BookStore_V1\.classpath
?????文件???????1045??2011-12-15?19:36??網上書店\BookStore_V1\.project
?????文件????????503??2011-12-15?19:36??網上書店\BookStore_V1\.settings\.jsdtscope
?????文件????????395??2011-12-15?19:36??網上書店\BookStore_V1\.settings\org.eclipse.jdt.core.prefs
?????文件????????466??2011-12-15?19:36??網上書店\BookStore_V1\.settings\org.eclipse.wst.common.component
?????文件????????345??2011-12-15?19:36??網上書店\BookStore_V1\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2011-12-15?19:36??網上書店\BookStore_V1\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2011-12-15?19:36??網上書店\BookStore_V1\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????1966??2011-12-15?19:59??網上書店\BookStore_V1\build\classes\book\bk.class
?????文件????????821??2011-12-15?19:47??網上書店\BookStore_V1\build\classes\book\SessionCounter.class
?????文件???????1394??2011-12-19?23:10??網上書店\BookStore_V1\src\book\bk.java
?????文件????????515??2011-12-15?00:30??網上書店\BookStore_V1\src\book\SessionCounter.java
?????文件???????1659??2011-12-15?21:28??網上書店\BookStore_V1\WebContent\cart.jsp
?????文件???????3804??2011-12-15?20:56??網上書店\BookStore_V1\WebContent\index.jsp
?????文件????????544??2011-12-15?00:30??網上書店\BookStore_V1\WebContent\login.html
?????文件????????946??2011-12-15?00:30??網上書店\BookStore_V1\WebContent\login_confirm.jsp
?????文件?????????39??2011-12-15?19:36??網上書店\BookStore_V1\WebContent\me
?????文件???????2719??2011-12-15?20:56??網上書店\BookStore_V1\WebContent\order.jsp
?????文件???????1519??2011-12-15?20:04??網上書店\BookStore_V1\WebContent\shopcart.jsp
?????文件???????2992??2011-12-15?20:56??網上書店\BookStore_V1\WebContent\submit_order.jsp
?????文件?????495944??2006-10-20?00:17??網上書店\BookStore_V1\WebContent\WEB-INF\lib\mysql-connector-java-5.0.4-bin.jar
?????文件???????1026??2011-12-15?21:48??網上書店\BookStore_V1\WebContent\WEB-INF\web.xm
?????文件????????833??2011-12-15?19:36??網上書店\BookStore_V2\.classpath
?????文件???????1045??2011-12-15?22:04??網上書店\BookStore_V2\.project
?????文件????????503??2011-12-15?19:36??網上書店\BookStore_V2\.settings\.jsdtscope
?????文件????????395??2011-12-15?19:36??網上書店\BookStore_V2\.settings\org.eclipse.jdt.core.prefs
?????文件????????466??2011-12-15?19:36??網上書店\BookStore_V2\.settings\org.eclipse.wst.common.component
?????文件????????345??2011-12-15?19:36??網上書店\BookStore_V2\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2011-12-15?19:36??網上書店\BookStore_V2\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2011-12-15?19:36??網上書店\BookStore_V2\.settings\org.eclipse.wst.jsdt.ui.superType.name
............此處省略195個文件信息
- 上一篇:音樂網站JSP+SERVLET
- 下一篇:XFire返回自定義實體類
評論
共有 條評論