资源简介
北大青鸟Java学士后第二单元项目——超市账单管理系统
能跑,内附Java代码,Oracle数据库代码,数据库用户名,数据库密码,数据库创建的表等,如果需要可下载(^U^)ノ~YO

代码片段和文件信息
package Dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import unit.ConfigManager;
public class baseDao {
protected Connection con;
protected PreparedStatement pps;
protected Statement stmt;
protected ResultSet rs;
public boolean getConnection() {
String driver=ConfigManager.getInstance().getString(“jdbc.driver_class“);
String url=ConfigManager.getInstance().getString(“jdbc.connection.url“);
String username=ConfigManager.getInstance().getString(“jdbc.connection.username“);
String password=ConfigManager.getInstance().getString(“jdbc.connection.password“);
try {
Class.forName(driver);
con = DriverManager.getConnection(url username password);
System.out.println(“数据库已经连接“);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return false;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return true;
}
public Connection getConnection2() {
try {
Context cxt=new InitialContext();
DataSource ds=(DataSource)cxt.lookup(“java:comp/env/jdbc/orcl“);
con=ds.getConnection();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return con;
}
public int executeUpdate(String sql object[] params) {
int updateRows = 0;
getConnection2();
//System.out.println(sql);
try {
pps=con.prepareStatement(sql);
for(int i=0;i pps.setobject(i+1 params[i]);
}
updateRows=pps.executeUpdate();
System.out.println(updateRows);
} catch (SQLException e) {
e.printStackTrace();
}
return updateRows;
}
public ResultSet executeSQL(String sqlobject[] params) {
getConnection();
try {
pps=con.prepareStatement(sql);
//遍历这个集合
for(int i=0;i pps.setobject(i+1 params[i]);
}
rs=pps.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
}
// 关闭各类资源
public boolean closeResource() {
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
if(pps!=null){
try {
pps.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
if(stmt!=null){
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
if(con!=null){
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
return true;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-11-23 20:34 北大青鸟学士后第二单元项目——超市账单管理系统 \
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\
文件 834 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.classpath
文件 906 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.project
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\
文件 567 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\.jsdtscope
文件 364 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\org.eclipse.jdt.core.prefs
文件 470 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\org.eclipse.wst.common.component
文件 345 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2016-11-10 13:45 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\Dao\
文件 3650 2016-11-19 15:22 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\Dao\ba
文件 322 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\Dao\BillDao.class
文件 334 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\Dao\SupplierDao.class
文件 284 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\Dao\UserDao.class
文件 180 2016-11-17 09:56 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\databa
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\entity\
文件 2485 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\entity\Bill.class
文件 1783 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\entity\Supplier.class
文件 2024 2016-11-17 16:14 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\entity\User.class
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\impl\
文件 9991 2016-11-23 13:15 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\impl\BillDaoImpl.class
文件 6838 2016-11-20 11:04 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\impl\SupplierDaoImpl.class
文件 6548 2016-11-22 18:25 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\impl\UserDaoImpl.class
目录 0 2016-11-23 20:30 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\servlet\
文件 6620 2016-11-23 16:42 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\servlet\Bills.class
文件 2929 2016-11-23 20:27 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\servlet\Login.class
文件 5769 2016-11-23 20:23 北大青鸟学士后第二单元项目——超市账单管理系统 \beifen\build\classes\servlet\Suppliers.class
............此处省略83个文件信息
相关资源
- 美食天下项目Android版源码和Web版源码
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
- [免费]java实现有障碍物的贪吃蛇游戏
评论
共有 条评论