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

📄 getcustomerbean.java

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 JAVA
字号:
package itso.storedproc.bean;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBProcedureCall property values. It also provides 
 * methods that execute your SQL statement, return 
 * a DBProcedureCall reference, and return an array of objects  
 * representing the rows in the result set.
 * Generated:  Apr 7, 2003 2:34:17 PM
 */

public class GetCustomerBean {
	private DBProcedureCall procCall;

	/**
	 * Constructor for a DBProcedureCall class.
	 */
	public GetCustomerBean() {
		super();
		initializer();
	}

	/**
	 * Creates a DBProcedureCall instance and initializes its properties.
	 */
	protected void initializer() {
		procCall = new DBProcedureCall();
		try {
			procCall.setDataSourceName("jdbc/ejbbank");
			procCall.setCommand("{ CALL ITSO.getCustomer (:customerID) }");
			DBParameterMetaData parmMetaData = procCall.getParameterMetaData();
			parmMetaData.setParameter(
				1,
				"customerID",
				java.sql.DatabaseMetaData.procedureColumnIn,
				java.sql.Types.INTEGER,
				Integer.class);
		} catch (SQLException ex) {
			ex.printStackTrace();
		}
	}

	/**
	 * Executes the SQL statement.
	 */
	public void execute(Integer customerID) throws SQLException {
		try {
			procCall.setUsername("db2admin");
			procCall.setPassword("db2admin");

			// Set stored procedure input parameters. 
			procCall.setParameter("customerID", customerID);
			procCall.execute();
		}

		// Free resources of procCall object. 
		finally {
			procCall.close();
		}
	}

	/**
	 * Returns a DBProcedureCall reference.
	 */
	public DBProcedureCall getDBProcedureCall() {
		return procCall;
	}

	/**
	 * Returns an array of objects representing the rows in the result set.
	 */
	public GetCustomerBeanRow[] getRows() {
		GetCustomerBeanRow[] rows =
			new GetCustomerBeanRow[procCall.getRowCount()];
		for (int i = 0; i <= procCall.getRowCount() - 1; i++) {
			rows[i] = new GetCustomerBeanRow(procCall, i + 1);
		};
		return rows;
	}
}

⌨️ 快捷键说明

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