一个连接池(DBConnectionManager.class)的数据库操作operate.class,但是,我不会修改。怎么办?有什么好的办法。谢谢!

thkact 2003-03-06 02:38:56
我不会修改数据库操作的BEAN.怎么办?有什么参考的资料吗 ?谢谢!
...全文
29 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
thkact 2003-03-06
  • 打赏
  • 举报
回复
to :: flashroom
我一直在线:
我以前用的 是jsp+mysql,所以说:存储过程、触发器等SQL语句都写在了文本中,现在,我想用JSP+ORACLE来修改。可以在datasetbean中直接调用oracle中的存储过程、触发器。代码,很长。
我的连接池调试通过了。现在要修改数据库操作bean了,我已经修改一个星期了,郁闷中,

谢谢!我给你发E-MAIL.可以吗 ?
thkact 2003-03-06
  • 打赏
  • 举报
回复
package connect;
import content.DBConnectionManager;
import content.FileUtils;
import content.EIEException;
import java.io.*;
import java.sql.*;
import java.util.HashMap;
import java.util.Set;
import java.util.Iterator;
public class DataSetBean{
private DBConnectionManager DBcnnManager;
private FileUtils fmt = new FileUtils();
private FileUtils dbutils = new FileUtils();

private Connection conn = null;
private Statement stmt = null;
private ResultSet rset = null;
private HashMap set_hm = null;

private String type = "";
private String filter = "";
private String sorter = "";
private String dataSource = "";

//#############################################################################################################
//public DataSetBean()
//功 能:构造函数--声明对象并建立数据库连接
//返回值:出错抛出EIEException异常
//#############################################################################################################
public DataSetBean() throws EIEException
{

DBcnnManager=DBConnectionManager.getInstance();
conn = DBcnnManager.getConnection("sand");
if(conn == null)
throw new EIEException("DB001");
fmt.setFile("format.txt");
if(fmt.openFile())
fmt.loadFormat();
}

//#############################################################################################################
//public void init ( String Type, String DataSource, String Filter, String Sorter)
//功 能:Bean的初始化。
//参数一:Type 类型的值为table、storeproc、view。
//参数二:DataSource为table、storeproc、view名称(即表名或存储过程名称或视的名称;
// 对于storeproc和view,其实现语句以文本形式存放在\Resource\DBApp\下,
// DataSource就是相应的文本文件的文件名).
//参数三:Filter为过滤条件(对table和view有效);
//参数四:Sorter为排序字段(对table和view有效);对于storeproc ,
// Sorter是相应存储过程的参数(形式为para1¶2¶3&………)
//返回值:出错抛出EIEException异常
//#############################################################################################################
public void init (String Type,String Datasource,String Filter,String Sorter) throws EIEException
{
this.type = Type.trim().toUpperCase();
this.filter = Filter.trim();
this.dataSource = Datasource.trim();
this.sorter = Sorter.trim();
//check the privilege of user
// throw new IEIException("IEI0001");

if(this.type.equals(""))
throw new EIEException("DB002");
if(!this.type.equals("TABLE") && !this.type.equals("VIEW") && !this.type.equals("STOREPROC"))
throw new EIEException("DB002");
if(this.dataSource.equals(""))
throw new EIEException("DB002");

}

//#############################################################################################################
//public int execute()
//功 能:执行Bean的初始化的操作。
//无参数:
//返回值:如果正确,返回值为正整数,表示记录集的记录总数;否则抛出EIEException异常
//#############################################################################################################
public int execute() throws EIEException
{
int success = 0;
if(!this.type.equals("") && !this.dataSource.equals(""))
{
if(this.type.equals("STOREPROC"))
success=executeProcedure(this.dataSource,this.sorter);
if(this.type.equals("TABLE") || this.type.equals("VIEW"))
success=executeQuery(this.getSqlString());

}

return success;
}
flashroom 2003-03-06
  • 打赏
  • 举报
回复
想怎么改?把代码帖出来我帮你
thkact 2003-03-06
  • 打赏
  • 举报
回复
谢谢!!!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧