⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbcommit.java

📁 java阿里巴巴代码
💻 JAVA
字号:
package com.saas.sys.dbm;

import java.sql.Connection;
import java.sql.SQLException;

public class Dbcommit {
	private Connection connectionHandle = null;
	private DbConnect thisConn = new DbConnect();
	
	public void setThisConn(DbConnect thisConn) 
	{
		this.thisConn = thisConn;
	}
	public DbConnect getThisConn()
	{
		return thisConn;
	}
	/** 
	 * Returns the rsrv_str4.
	 * @return String 
	 */
	public Connection getConnectionHandle()
	{
		return connectionHandle;
	}
	/** 
	 * Set the rsrv_str4.
	 * @param rsrv_str4 The rsrv_str4 to set
	 */
	public void setConnectionHandle(Connection connectionHandle) 
	{
		this.connectionHandle = connectionHandle;
	}
	
	public void getConnect()
	{		
		try
		{
			this.connectionHandle =thisConn.getConnection();
		}
		catch (Exception e)
		{	
			throw new RuntimeException(e);
		}		
		
	}
	/**
	 * @Method Name: TradeSubmit();
	 */
	public void tradeCommit()
	{
		/**执行本次事务**/
		try
		{
			connectionHandle.commit();
		}
		catch (Exception e)
		{		
			try
			{
				connectionHandle.rollback();
			}
			catch (SQLException ed)
			{
				throw new RuntimeException(ed);
			}
			throw new RuntimeException(e);
		}
		finally
		{
			try
			{
				closeConn();
			}
			catch (Exception e)
			{		
				throw new RuntimeException(e);
			}
		}
	}

	/**
	 * @author: 王仁超
	 * @Date: 2005-7-13
	 * @Method Name: CloseConn
	 */
	public void closeConn()
	{
		try
		{
			this.connectionHandle.close();
		}
		catch (SQLException e)
		{	
			throw new RuntimeException(e);
		}
	}
}

⌨️ 快捷键说明

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