databasecommmgr.java

来自「java阿里巴巴代码」· Java 代码 · 共 109 行

JAVA
109
字号
/*
 * Created on 2006-6-18
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.ahbay.commenMgr;

import com.ahbay.DataBaseMgr.*;
import java.sql.*;
/**
 * @author: Wangrc
 * @Date: 2006-6-18 20:49:14
 * @Method Name: 
 */
public class DataBaseCommMgr 
{
	public DataBaseCommMgr(){}
	private String strQuery;
	private Connection ConnectionHandle;
	/** 
	 * Returns the rsrv_str4.
	 * @return String
	 */
	public String getStrQuery()
	{
		return strQuery;
	}
	/** 
	 * Set the rsrv_str4.
	 * @param rsrv_str4 The rsrv_str4 to set
	 */
	public void setStrQuery(String strQuery)
	{
		this.strQuery = strQuery;
	}	
	
	
	/**
	 * 
	 * @author: Wangrc
	 * @Date: 2006-6-18 20:44:46
	 * @Method Name: ExecInsert
	 */
	public String ExecBizQuery()
	{
		this.ConnectionHandle=null; 
		DataBaseConn ThisConn=new DataBaseConn();
		this.ConnectionHandle =ThisConn.GetConnection();	
		Statement stm;	
		try
		{			 
			stm=this.ConnectionHandle.createStatement();
			stm.executeUpdate(this.strQuery);
			this.ConnectionHandle.commit();			 
		}
		catch (SQLException e)
		{		
			return e.getMessage()+"||"+this.strQuery;		
		}
		catch (Exception e)
		{		
			return e.getMessage()+"||"+this.strQuery;		
		}
		CloseConn();			
		return "1";
	}
	/**
	 * @author: 王仁超
	 * @Date: 2005-7-13
	 * @Method Name: CloseConn
	 */
	public void CloseConn()
	{
		try
		{
			this.ConnectionHandle.close();
		}
		catch (SQLException e)
		{	
			System.out.println("SQLERROR:"+e.getMessage());		
		}
	}
	/**
	 * 
	 * @author: Wangrc
	 * @Date: 2006-6-18 20:44:46
	 * @Method Name: SelBizQuery
	 */
	public ResultSet SelBizQuery()
	{
		this.ConnectionHandle=null; 
		DataBaseConn ThisConn=new DataBaseConn();
		this.ConnectionHandle =ThisConn.GetConnection();	
		Statement stm;
		ResultSet rst = null;	
		try
		{			 
			stm = this.ConnectionHandle.createStatement();
			rst = stm.executeQuery(this.strQuery);			 
		}
		catch (SQLException e)
		{		
			System.out.println("SQLERROR:"+e.getMessage());		
		}		
		return rst;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?