資源簡介
本人的實訓報告,當作參考了
Java 圖書管理系統實訓報告

代碼片段和文件信息
package?db;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.util.ArrayList;
import?java.util.List;
import?entity.Book;
import?entity.Reader;
public?class?baseDao?{
protected?static?String?driver?=?“com.mysql.jdbc.Driver“; //數據庫驅動
protected?static?String?url?=?“jdbc:mysql://localhost:3306/tsgl“; //連接url
protected?static?String?dbUser?=?“root“; //數據庫用戶名
protected?static?String?dbPwd?=?“qwe123“; //數據庫密碼
private?static?Connection?conn?=?null;
/**
?*?構造方法,創建數據庫連接
?*/
private?baseDao()?{
try?{
if?(conn?==?null)?{
Class.forName(driver); //加載數據庫驅動
conn?=?DriverManager.getConnection(url?dbUser?dbPwd); //建立數據庫連接
}?else
return;
}?catch?(Exception?ee)?{
ee.printStackTrace();
}
}
/**
?*?執行數據庫查詢操作
?*?@param?sql
?*?@return
?*/
public?static?ResultSet?executeQuery(String?sql)?{
try?{
if?(conn?==?null)
new?baseDao();
return?conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE
ResultSet.CONCUR_UPDATABLE).executeQuery(sql); //執行數據庫查詢
}?catch?(SQLException?e)?{
e.printStackTrace();
return?null;
}?
}
/**
?*?執行數據庫更新操作
?*?@param?sql
?*?@return
?*/
public?static?int?executeUpdate(String?sql)?{
try?{
if?(conn?==?null)
new?baseDao();
return?conn.createStatement().executeUpdate(sql); //執行數據庫更新
}?catch?(SQLException?e)?{
System.out.println(e.getMessage());
return?-1;
}?finally?{
}
}
public?static?void?close()?{
try?{
conn.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}?finally?{
conn?=?null;
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????643584??2010-07-12?08:36???10號\報告\課程設計報告.doc
?????目錄??????????0??2010-07-08?15:17???10號\報告
?????文件????????390??2008-09-17?18:25???10號\程序代碼\tsgl\.classpath
?????文件????????380??2009-03-27?15:35???10號\程序代碼\tsgl\.project
?????文件???????9496??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\Back.java
?????文件???????6929??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\BookAdd.java
?????文件???????8221??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\BookDelete.java
?????文件???????3940??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\BookQuery.java
?????文件???????8501??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\BookUpdate.java
?????文件???????9739??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\Borrow.java
?????文件???????3369??2008-12-11?14:10???10號\程序代碼\tsgl\src\window\Login.java
?????文件???????7391??2008-10-08?10:03???10號\程序代碼\tsgl\src\window\Main.java
?????文件???????5585??2008-12-11?14:27???10號\程序代碼\tsgl\src\window\ReaderAdd.java
?????文件???????6415??2008-12-11?14:29???10號\程序代碼\tsgl\src\window\ReaderDelete.java
?????文件???????3827??2008-09-17?18:25???10號\程序代碼\tsgl\src\window\ReaderQuery.java
?????文件???????6879??2008-12-11?14:28???10號\程序代碼\tsgl\src\window\ReaderUpdate.java
?????文件????????460??2008-12-11?14:02???10號\程序代碼\tsgl\src\window\UIUtil.java
?????文件???????4267??2008-12-11?14:39???10號\程序代碼\tsgl\src\window\UpdatePassword.java
?????目錄??????????0??2010-07-08?15:17???10號\程序代碼\tsgl\src\window
?????文件????????324??2008-09-17?18:25???10號\程序代碼\tsgl\src\util\Constant.java
?????文件???????1882??2008-09-17?18:25???10號\程序代碼\tsgl\src\util\DateUtils.java
?????文件?????????98??2008-09-17?18:25???10號\程序代碼\tsgl\src\util\GlobalVar.java
?????目錄??????????0??2010-07-08?15:17???10號\程序代碼\tsgl\src\util
?????文件???????2310??2008-09-17?18:25???10號\程序代碼\tsgl\src\entity\Book.java
?????文件???????1545??2008-09-17?18:25???10號\程序代碼\tsgl\src\entity\Borrow.java
?????文件???????1476??2008-09-17?18:25???10號\程序代碼\tsgl\src\entity\Reader.java
?????目錄??????????0??2010-07-08?15:17???10號\程序代碼\tsgl\src\entity
?????文件???????1821??2008-10-08?09:49???10號\程序代碼\tsgl\src\db\ba
?????文件???????1673??2008-09-17?18:25???10號\程序代碼\tsgl\src\db\BookDao.java
?????文件???????1435??2008-09-17?18:25???10號\程序代碼\tsgl\src\db\ReaderDao.java
............此處省略85個文件信息
- 上一篇:JSP藥品進銷存管理系統的設計與實現
- 下一篇:java實現人臉識別
評論
共有 條評論