﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Gay Bird-文章分类-Java</title><link>http://www.blogjava.net/hnicypb/category/34332.html</link><description>登高者必自卑，行远者必自迩，在这个世界上，重要的不是你正站在那里，而是你正朝什么方向移动......
</description><language>zh-cn</language><lastBuildDate>Tue, 09 Sep 2008 02:28:15 GMT</lastBuildDate><pubDate>Tue, 09 Sep 2008 02:28:15 GMT</pubDate><ttl>60</ttl><item><title>JSF入门与提高目录（有实例子） </title><link>http://www.blogjava.net/hnicypb/articles/227874.html</link><dc:creator>Sky Yi</dc:creator><author>Sky Yi</author><pubDate>Tue, 09 Sep 2008 02:21:00 GMT</pubDate><guid>http://www.blogjava.net/hnicypb/articles/227874.html</guid><wfw:comment>http://www.blogjava.net/hnicypb/comments/227874.html</wfw:comment><comments>http://www.blogjava.net/hnicypb/articles/227874.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hnicypb/comments/commentRss/227874.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hnicypb/services/trackbacks/227874.html</trackback:ping><description><![CDATA[如果您是从使用的角度来看JSF，则您不用理会HTTP、数据转换等细节，JSF将细节都隐藏起来了，无论您是网页设计人员或是应用程序设计人员，都可以使用自己熟悉的方式来看JSF。
<p><strong>入门<br />
</strong>藉由以下的几个主题，可以大致了解JSF的轮廓与特性，我们来看看网页设计人员与应用程序设计人员各负责什么。<br />
o <a href="http://www.djyeh.com/post/790.html">简介JSF</a><br />
o <a href="http://www.djyeh.com/post/791.html">第一个JSF程序</a><br />
o <a href="http://www.djyeh.com/post/792.html">简单的导航 Navigation</a><br />
o <a href="http://www.djyeh.com/post/793.html">导航规则设置</a><br />
o <a href="http://www.djyeh.com/post/794.html">JSF Expression Language<br />
</a>o <a href="http://www.djyeh.com/post/795.html">国际化讯息</a> <br />
<strong>Managed Beans<br />
</strong>JSF 使用 Bean 来达到逻辑层与表现层分离的目的，Bean 的管理集中在组态档案中，您只要修改组态档案，就可以修改 Bean 之间的相依关系。<br />
o <a href="http://www.djyeh.com/post/796.html">Backing Beans</a><br />
o <a href="http://www.djyeh.com/post/797.html">Beans 的组态与设定</a><br />
o <a href="http://www.djyeh.com/post/798.html">Beans 上的 List, Map</a> <br />
<strong>数据转换与验证</strong><br />
转换器（Converter）协助模型与视图之间的数据转换，验证器（Validator）协助进行语意检验（Semantic Validation）。<br />
o <a href="http://www.djyeh.com/post/799.html">标准转换器</a><br />
o <a href="http://www.djyeh.com/post/800.html">自订转换器</a><br />
o <a href="http://www.djyeh.com/post/801.html">标准验证器</a><br />
o <a href="http://www.djyeh.com/post/802.html">自订验证器</a><br />
o <a href="http://www.djyeh.com/post/803.html">错误讯息处理</a><br />
o <a href="http://www.djyeh.com/post/804.html">自订转换, 验证标签</a><br />
<strong>事件处理</strong><br />
JSF的事件模型提供一个近似的桌面GUI事件模式，让熟悉GUI设计的人员也能快速上手Web程序设计。<br />
o <a href="http://www.djyeh.com/post/809.html">动作事件</a><br />
o <a href="http://www.djyeh.com/post/810.html">实时事件</a><br />
o <a href="http://www.djyeh.com/post/811.html">值变事件</a><br />
o <a href="http://www.djyeh.com/post/812.html">Phase 事件</a><br />
<strong>　JSF 标签</strong></p>
<p>　　网页设计人员要作的就是了解JSF的标签的使用方式，这就像是学习进阶的HTML标签，另一件事就是与程序设计人员沟通好各个Bean的名称绑定。</p>
<p><strong>标签入门</strong><br />
卷标的相关属性查询，您可以参考 Tag Library Documentation，这边的介绍只是一些简单的入门实例。<br />
o <a href="http://www.djyeh.com/post/813.html">简介JSF标准标签</a><br />
o <a href="http://*/814.html">输出类标签</a><br />
o <a href="http://www.djyeh.com/post/814.html">输入类标签</a><br />
o <a href="http://www.djyeh.com/post/815.html">命令类标签</a><br />
o <a href="http://www.djyeh.com/post/818.html">选择类标签 一</a><br />
o <a href="http://www.djyeh.com/post/819.html">选择类标签 二</a><br />
o <a href="http://www.djyeh.com/post/820.html">其它标签</a><br />
<strong>表格处理</strong><br />
对于必须使用表格方式呈现的数据，JSF 的 &lt;h:dataTable&gt; 卷标协助您进行动态表格数据的输出。<br />
o <a href="http://www.djyeh.com/post/821.html">简单的表格</a><br />
o <a href="http://www.djyeh.com/post/822.html">表头, 表尾</a><br />
o <a href="http://www.djyeh.com/post/823.html">TableModel 类别</a><br />
<strong>　自订组件</strong></p>
<p>　　JSF 让您可以自订组件，每个组件都是可替换的，这使得组件在搭配时更有弹性，但相对的却使开发组件的过程复杂的多，这边对自订JSF 组件只是个入门砖，更多有关自订组件的细节可得要专书来说明。</p>
<p><strong>JSF 生命周期与组件概述</strong><br />
要开发 JSF 组件，您需要更深入了解 JSF 的一些处理细节，包括了 JSF 生命周期以及 JSF 框架。<br />
o <a href="http://www.djyeh.com/post/827.html">JSF 生命周期</a><br />
o <a href="http://www.djyeh.com/post/828.html">概述自订组件</a><br />
<strong>简单实例</strong><br />
在不考虑组件有子组件的情况下，这边以实际的一个例子来说明开发组件的过程，至于考虑子组件的情况请参考专书介绍。<br />
o <a href="http://www.djyeh.com/post/833.html">编码, 译码</a><br />
o <a href="http://www.djyeh.com/post/834.html">组件卷标</a><br />
o <a href="http://www.djyeh.com/post/835.html">使用自订组件</a><br />
o <a href="http://www.djyeh.com/post/836.html">自订 Renderer<br />
</a></p>
<p>&nbsp;</p>
<img src ="http://www.blogjava.net/hnicypb/aggbug/227874.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hnicypb/" target="_blank">Sky Yi</a> 2008-09-09 10:21 <a href="http://www.blogjava.net/hnicypb/articles/227874.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>数据库操作管理类</title><link>http://www.blogjava.net/hnicypb/articles/226725.html</link><dc:creator>Sky Yi</dc:creator><author>Sky Yi</author><pubDate>Wed, 03 Sep 2008 09:19:00 GMT</pubDate><guid>http://www.blogjava.net/hnicypb/articles/226725.html</guid><wfw:comment>http://www.blogjava.net/hnicypb/comments/226725.html</wfw:comment><comments>http://www.blogjava.net/hnicypb/articles/226725.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hnicypb/comments/commentRss/226725.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hnicypb/services/trackbacks/226725.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<p>import java.sql.CallableStatement;<br />
import java.sql.Connection;<br />
import java.sql.DriverManager;<br />
import java.sql.PreparedStatement;<br />
import java.sql.ResultSet;<br />
import java.sql.ResultSetMetaData;<br />
import java.sql.SQLException;<br />
import java.sql.Statement;<br />
import java.sql.Types;<br />
import java.util.ArrayList;<br />
import java.util.HashMap;<br />
import java.util.Iterator;<br />
import org.apache.log4j.Logger;</p>
<p>/**<br />
&nbsp;* 数据库操作管理类<br />
&nbsp;* <br />
&nbsp;* @author Harlyhood<br />
&nbsp;* <br />
&nbsp;*/<br />
public class DBManager {</p>
<p>&nbsp;// --------------------------------------------------------- Instance<br />
&nbsp;private static Logger logger = Logger.getLogger(DBManager.class);<br />
&nbsp;// --------------------------------------------------------- Methods</p>
<p>&nbsp;// 数据库连接对象<br />
&nbsp;private Connection con;<br />
&nbsp;// SQL语句对象<br />
&nbsp;private Statement stmt;<br />
&nbsp;// 带参数的Sql语句对象<br />
&nbsp;private PreparedStatement pstmt;<br />
&nbsp;// 记录集对象<br />
&nbsp;private ResultSet rs;<br />
&nbsp;// 数据连接管理（连接池对象）<br />
&nbsp;private DBConnectionManager dcm = null;</p>
<p>&nbsp;/** ***********************手动设置的连接参数********************************* */<br />
&nbsp;@SuppressWarnings("unused")<br />
&nbsp;private static String _DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";<br />
&nbsp;@SuppressWarnings("unused")<br />
&nbsp;private static String _URL = "jdbc:sqlserver://localhost:1433;database=Hospital_AI_DB;characterEncoding=gb2312";<br />
&nbsp;@SuppressWarnings("unused")<br />
&nbsp;private static String _USER_NA = "sa";<br />
&nbsp;@SuppressWarnings("unused")<br />
&nbsp;private static String _PASSWORD = "";</p>
<p>&nbsp;/** ********************************************************************** */</p>
<p>&nbsp;// 默认构造<br />
&nbsp;public DBManager() {<br />
&nbsp;}</p>
<p>&nbsp;/** ****************************************************************************************** */<br />
&nbsp;/**<br />
&nbsp; * **************************************** 数据库连接初始化<br />
&nbsp; * ***********************************<br />
&nbsp; */<br />
&nbsp;/** ****************************************************************************************** */</p>
<p>&nbsp;/**<br />
&nbsp; * 得到一个默认的数据库连接[从 com.hospital.dao.tools.db.properties文件初始化]<br />
&nbsp; * <br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;private void getConnection() {<br />
&nbsp;&nbsp;logger.info("###############open:::::从默认的配置文件得到一个数据库连接");<br />
&nbsp;&nbsp;// 获取一个连接池管理类的实例<br />
&nbsp;&nbsp;dcm = DBConnectionManager.getInstance();<br />
&nbsp;&nbsp;// 得到一个数据库连接<br />
&nbsp;&nbsp;con = dcm.getConnection("mysql");</p>
<p>&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;con.setAutoCommit(false);<br />
&nbsp;&nbsp;} catch (SQLException e) {</p>
<p>&nbsp;&nbsp;&nbsp;e.printStackTrace();<br />
&nbsp;&nbsp;}<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 从指定参数得到一个连接对象<br />
&nbsp; * <br />
&nbsp; * @param driver<br />
&nbsp; * @param url<br />
&nbsp; * @param user_na<br />
&nbsp; * @param password<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public void getConnection(String driver, String url, String user_na,<br />
&nbsp;&nbsp;&nbsp;String password) throws Exception {<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;logger.info("###############open:::::从指定配置中得到一个数据库连接");<br />
&nbsp;&nbsp;&nbsp;Class.forName(driver);<br />
&nbsp;&nbsp;&nbsp;con = DriverManager.getConnection(url, user_na, password);<br />
&nbsp;&nbsp;} catch (ClassNotFoundException ex) {<br />
&nbsp;&nbsp;&nbsp;logger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.info("###############Error[com.hospital.dao.tools.DBManager^^^Method:getConnection^^^Line:81]找不到类驱动类: "<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ driver);<br />
&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;logger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.info("###############Error[com.hospital.dao.tools.DBManager^^^Method:getConnection^^^Line:81]加载类: "<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ driver + " 时出现 SQLException 异常");<br />
&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;}<br />
&nbsp;}</p>
<p>&nbsp;/** ****************************************************************************************** */<br />
&nbsp;/**<br />
&nbsp; * **************************************** 数据库操作方法<br />
&nbsp; * ***********************************<br />
&nbsp; */<br />
&nbsp;/** ****************************************************************************************** */</p>
<p>&nbsp;/**<br />
&nbsp; * 执行SQL语句操作(更新数据 无参数)<br />
&nbsp; * <br />
&nbsp; * @param strSql<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL语句<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public boolean executeUpdate(String strSql) throws SQLException {<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;// getConnection(_DRIVER,_URL,_USER_NA,_PASSWORD);<br />
&nbsp;&nbsp;boolean flag = false;<br />
&nbsp;&nbsp;stmt = con.createStatement();<br />
&nbsp;&nbsp;logger.info("###############::执行SQL语句操作(更新数据 无参数):" + strSql);<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;if (0 &lt; stmt.executeUpdate(strSql)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;close_DB_Object();<br />
&nbsp;&nbsp;&nbsp;&nbsp;flag = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;logger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.info("###############Error DBManager Line126::执行SQL语句操作(更新数据 无参数):"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ strSql + "失败!");<br />
&nbsp;&nbsp;&nbsp;flag = false;<br />
&nbsp;&nbsp;&nbsp;con.rollback();<br />
&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return flag;</p>
<p>&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行SQL语句操作(更新数据 有参数)<br />
&nbsp; * <br />
&nbsp; * @param strSql<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sql指令<br />
&nbsp; * @param prams<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参数列表<br />
&nbsp; * @return<br />
&nbsp; * @throws SQLException<br />
&nbsp; */<br />
&nbsp;public boolean executeUpdate(String strSql, HashMap&lt;Integer, Object&gt; prams)<br />
&nbsp;&nbsp;&nbsp;throws SQLException, ClassNotFoundException {<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;// getConnection(_DRIVER,_URL,_USER_NA,_PASSWORD);<br />
&nbsp;&nbsp;boolean flag = false;<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;pstmt = con.prepareStatement(strSql);<br />
&nbsp;&nbsp;&nbsp;setParamet(pstmt, prams);<br />
&nbsp;&nbsp;&nbsp;logger.info("###############::执行SQL语句操作(更新数据 有参数):" + strSql);</p>
<p>&nbsp;&nbsp;&nbsp;if (0 &lt; pstmt.executeUpdate()) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;close_DB_Object();<br />
&nbsp;&nbsp;&nbsp;&nbsp;flag = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;logger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.info("###############Error DBManager Line121::执行SQL语句操作(更新数据 无参数):"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ strSql + "失败!");<br />
&nbsp;&nbsp;&nbsp;flag = false;<br />
&nbsp;&nbsp;&nbsp;con.rollback();<br />
&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;} catch (ClassNotFoundException ex) {<br />
&nbsp;&nbsp;&nbsp;logger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.info("###############Error DBManager Line152::执行SQL语句操作(更新数据 无参数):"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ strSql + "失败! 参数设置类型错误!");<br />
&nbsp;&nbsp;&nbsp;con.rollback();<br />
&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return flag;</p>
<p>&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行SQL语句操作(查询数据 无参数)<br />
&nbsp; * <br />
&nbsp; * @param strSql<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL语句<br />
&nbsp; * @return 数组对象列表<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; executeSql(String strSql)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;// getConnection(_DRIVER,_URL,_USER_NA,_PASSWORD);<br />
&nbsp;&nbsp;stmt = con.createStatement();<br />
&nbsp;&nbsp;logger.info("###############::执行SQL语句操作(查询数据):" + strSql);<br />
&nbsp;&nbsp;rs = stmt.executeQuery(strSql);<br />
&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;if (null != rs) {<br />
&nbsp;&nbsp;&nbsp;return convertResultSetToArrayList(rs);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;close_DB_Object();<br />
&nbsp;&nbsp;return null;<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行SQL语句操作(查询数据 有参数)<br />
&nbsp; * <br />
&nbsp; * @param strSql<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL语句<br />
&nbsp; * @param prams<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参数列表<br />
&nbsp; * @return 数组对象列表<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; executeSql(String strSql,<br />
&nbsp;&nbsp;&nbsp;HashMap&lt;Integer, Object&gt; prams) throws Exception {<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;// getConnection(_DRIVER,_URL,_USER_NA,_PASSWORD);<br />
&nbsp;&nbsp;pstmt = con.prepareStatement(strSql);<br />
&nbsp;&nbsp;setParamet(pstmt, prams);<br />
&nbsp;&nbsp;logger.info("###############::执行SQL语句操作(查询数据):" + strSql);<br />
&nbsp;&nbsp;rs = pstmt.executeQuery();<br />
&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;if (null != rs) {<br />
&nbsp;&nbsp;&nbsp;return convertResultSetToArrayList(rs);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return null;<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行存储过程(查询数据 无参数)<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @return 数组列表对象<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; executeProcedureQuery(<br />
&nbsp;&nbsp;&nbsp;String procName) throws Exception {<br />
&nbsp;&nbsp;getConnection();// 获取连接<br />
&nbsp;&nbsp;String callStr = "{call " + procName + "}";// 构造执行存储过程的sql指令<br />
&nbsp;&nbsp;CallableStatement cs = con.prepareCall(callStr);<br />
&nbsp;&nbsp;logger.info("###############::执行存储过程(查询数据):" + procName);<br />
&nbsp;&nbsp;rs = cs.executeQuery();<br />
&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;cs.close();<br />
&nbsp;&nbsp;close_DB_Object();<br />
&nbsp;&nbsp;return convertResultSetToArrayList(rs);<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行存储过程(查询数据,带参数)返回结果集合<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @param parameters<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参数对象数组<br />
&nbsp; * @param al<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数组列表对象<br />
&nbsp; * @return 数组列表对象<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; executeProcedureQuery(<br />
&nbsp;&nbsp;&nbsp;String procName, Object[] parameters) throws Exception {<br />
&nbsp;&nbsp;int parameterPoint = 0;<br />
&nbsp;&nbsp;// 获取存储过程信息列表集合<br />
&nbsp;&nbsp;ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; procedureInfo = getProcedureInfo(procName);<br />
&nbsp;&nbsp;// 获取存储过程的完全名称<br />
&nbsp;&nbsp;String procedureCallName = getProcedureCallName(procName,parameters.length);<br />
&nbsp;&nbsp;// 获取连接对象<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;// 初始化 存储过程 执行对象<br />
&nbsp;&nbsp;CallableStatement cs = con.prepareCall(procedureCallName);<br />
&nbsp;&nbsp;// 参数下标变量<br />
&nbsp;&nbsp;int index = 0;<br />
&nbsp;&nbsp;// 获取 存储过程信息列表集合的 迭代器 对象<br />
&nbsp;&nbsp;Iterator&lt;HashMap&lt;Object, Object&gt;&gt; iter = procedureInfo.iterator();<br />
&nbsp;&nbsp;// 遍历存储过程信息列表集合<br />
&nbsp;&nbsp;while (iter.hasNext()) {<br />
&nbsp;&nbsp;&nbsp;HashMap&lt;Object, Object&gt; hm = iter.next();</p>
<p>&nbsp;&nbsp;&nbsp;parameterPoint++;<br />
&nbsp;&nbsp;&nbsp;// 如果参数是输入参数 way = 0<br />
&nbsp;&nbsp;&nbsp;if (hm.get("WAY").equals("0")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// 设置参数到cs<br />
&nbsp;&nbsp;&nbsp;&nbsp;cs.setObject(parameterPoint, parameters[index]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;// 参数下标+1<br />
&nbsp;&nbsp;&nbsp;&nbsp;index++;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;// 释放这个对象,做为第二次使用<br />
&nbsp;&nbsp;procedureInfo = null;<br />
&nbsp;&nbsp;logger.info("###############::执行存储过程(查询数据):::::" + procedureCallName);<br />
&nbsp;&nbsp;rs = cs.executeQuery();<br />
&nbsp;&nbsp;con.commit();<br />
&nbsp;&nbsp;procedureInfo = convertResultSetToArrayList(rs);<br />
&nbsp;&nbsp;cs.close();<br />
&nbsp;&nbsp;close_DB_Object();<br />
&nbsp;&nbsp;return procedureInfo;</p>
<p>&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 执行存储过程(更新，查询数据[简单查询、非纪录集]，返回输出参数[非纪录集])<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @param parameters<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参数对象数组<br />
&nbsp; * @param os<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 输出参数对象数组<br />
&nbsp; * @return 输出参数对象数组<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;public Object[] executeProcedureUpdate(String procName, Object[] parameters)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;logger.info("------------------------------------------------------------------------------------------------------");<br />
&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate ##############&nbsp;&nbsp; 正在执行 存储过程: " + procName +"&nbsp;&nbsp; ##############");<br />
&nbsp;&nbsp;CallableStatement cs = null;<br />
&nbsp;&nbsp;Object []returnVal = null;<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;// 获取 存储过程 调用全名<br />
&nbsp;&nbsp;String fullPCallName = getProcedureCallName(procName,parameters.length);<br />
&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 存储过程命令: " + fullPCallName +"&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;//获取存储过程参数信息<br />
&nbsp;&nbsp;ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; p_Call_Info_List = getProcedureInfo(procName);<br />
&nbsp;&nbsp;//获取连接<br />
&nbsp;&nbsp;getConnection();<br />
&nbsp;&nbsp;//创建 存储过程 执行对象<br />
&nbsp;&nbsp;cs = con.prepareCall(fullPCallName);<br />
&nbsp;&nbsp;//数组下标<br />
&nbsp;&nbsp;int index = 1;<br />
&nbsp;&nbsp;//输出参数下标 纪录<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ArrayList&lt;Integer&gt; outPutIndexList = new ArrayList&lt;Integer&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 参数个数是: " + parameters.length +"&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;for(HashMap&lt;Object,Object&gt; tempHash:p_Call_Info_List)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if("0".equals(tempHash.get("WAY")))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//设置输入参数<br />
&nbsp;&nbsp;&nbsp;&nbsp;cs.setObject(index, parameters[index-1]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 输入 Input: 编号:" + index +" 值: "+parameters[index-1]+" 类型: "+parameters[index-1].getClass()+"&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;//注册输出参数<br />
&nbsp;&nbsp;&nbsp;&nbsp;cs.registerOutParameter(index, getDataType(tempHash.get("TYPENAME").toString()));<br />
&nbsp;&nbsp;&nbsp;&nbsp;//纪录输出参数的下标<br />
&nbsp;&nbsp;&nbsp;&nbsp;outPutIndexList.add(index);<br />
&nbsp;&nbsp;&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 输出 OutPut: 编号:" + index +" 值: "+parameters[index-1]+" 类型: "+parameters[index-1].getClass()+"&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;index++;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 参数设置完毕,正在执行中 ... :&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;//-------------------- 执行 -----------------<br />
&nbsp;&nbsp;if(!cs.execute())<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;returnVal = new Object[outPutIndexList.size()];<br />
&nbsp;&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 执行成功! :&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;&nbsp;//取输 出参数的 返回值<br />
&nbsp;&nbsp;&nbsp;for(int i = 0 ;i&lt;outPutIndexList.size();i++)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;returnVal[i] = cs.getObject(outPutIndexList.get(i));<br />
&nbsp;&nbsp;&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 返回值 "+(i+1)+" "+returnVal[i]+"&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;con.commit();//提交<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;} catch (Exception e) {<br />
&nbsp;&nbsp;&nbsp;logger.info(" Run --&gt; executeProcedureUpdate #&nbsp;&nbsp; 执行失败!事务回滚中... :&nbsp;&nbsp; #");<br />
&nbsp;&nbsp;&nbsp;con.rollback();<br />
&nbsp;&nbsp;&nbsp;throw e;<br />
&nbsp;&nbsp;} <br />
&nbsp;&nbsp;logger.info("------------------------------------------------------------------------------------------------------");<br />
&nbsp;&nbsp;return returnVal;<br />
&nbsp;}</p>
<p>&nbsp;/** ****************************************************************************************** */<br />
&nbsp;/**<br />
&nbsp; * ********************************* 小工具<br />
&nbsp; * ************************************************<br />
&nbsp; */<br />
&nbsp;/** ****************************************************************************************** */</p>
<p>&nbsp;/**<br />
&nbsp; * 关闭数据对象<br />
&nbsp; */<br />
&nbsp;public void close_DB_Object() {<br />
&nbsp;&nbsp;logger.info("###############close:::::关闭连接对象，语句对象，记录集对象");<br />
&nbsp;&nbsp;if (null != rs) {<br />
&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;rs.close();<br />
&nbsp;&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;rs = null;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;if (null != stmt) {<br />
&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;stmt.close();<br />
&nbsp;&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;stmt = null;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;if (null != pstmt) {<br />
&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;pstmt.close();<br />
&nbsp;&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;pstmt = null;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;if (con != null) {<br />
&nbsp;&nbsp;&nbsp;dcm.freeConnection("mysql", con);<br />
&nbsp;&nbsp;}<br />
&nbsp;}</p>
<p><br />
&nbsp;/**<br />
&nbsp; * 设置Sql 指令参数<br />
&nbsp; * <br />
&nbsp; * @param p_stmt<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PreparedStatement<br />
&nbsp; * @param pramets<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HashMap<br />
&nbsp; */<br />
&nbsp;private PreparedStatement setParamet(PreparedStatement p_stmt,<br />
&nbsp;&nbsp;&nbsp;HashMap&lt;Integer, Object&gt; pramets) throws ClassNotFoundException,<br />
&nbsp;&nbsp;&nbsp;SQLException {<br />
&nbsp;&nbsp;// 如果参数为空<br />
&nbsp;&nbsp;if (null != pramets) {<br />
&nbsp;&nbsp;&nbsp;// 如果参数个数为0<br />
&nbsp;&nbsp;&nbsp;if (0 &lt;= pramets.size()) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 1; i &lt;= pramets.size(); i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 字符类型 String<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.lang.String")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setString(i, pramets.get(i).toString());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 日期类型 Date<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.sql.Date")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setDate(i, java.sql.Date.valueOf(pramets<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.get(i).toString()));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 布尔类型 Boolean<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.lang.Boolean")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setBoolean(i, (Boolean) (pramets.get(i)));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 整型 int<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.lang.Integer")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setInt(i, (Integer) pramets.get(i));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 浮点 float<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.lang.Float")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setFloat(i, (Float) pramets.get(i));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 双精度型 double<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pramets.get(i).getClass() == Class<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.forName("java.lang.Double")) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_stmt.setDouble(i, (Double) pramets.get(i));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch (ClassNotFoundException ex) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch (SQLException ex) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw ex;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return p_stmt;<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 转换记录集对象为数组列表对象<br />
&nbsp; * <br />
&nbsp; * @param rs<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 纪录集合对象<br />
&nbsp; * @return 数组列表对象<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;private ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; convertResultSetToArrayList(<br />
&nbsp;&nbsp;&nbsp;ResultSet rs) throws Exception {<br />
&nbsp;&nbsp;logger.info("###############::转换记录集对象为数组列表对象");<br />
&nbsp;&nbsp;// 获取rs 集合信息对象<br />
&nbsp;&nbsp;ResultSetMetaData rsmd = rs.getMetaData();<br />
&nbsp;&nbsp;// 创建数组列表集合对象<br />
&nbsp;&nbsp;ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; tempList = new ArrayList&lt;HashMap&lt;Object, Object&gt;&gt;();<br />
&nbsp;&nbsp;HashMap&lt;Object, Object&gt; tempHash = null;<br />
&nbsp;&nbsp;// 填充数组列表集合<br />
&nbsp;&nbsp;while (rs.next()) {<br />
&nbsp;&nbsp;&nbsp;// 创建键值对集合对象<br />
&nbsp;&nbsp;&nbsp;tempHash = new HashMap&lt;Object, Object&gt;();<br />
&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; rsmd.getColumnCount(); i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// 遍历每列数据，以键值形式存在对象tempHash中<br />
&nbsp;&nbsp;&nbsp;&nbsp;tempHash.put(rsmd.getColumnName(i + 1).toUpperCase(), rs<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getString(rsmd.getColumnName(i + 1)));<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;// 第一个键值对，存储在tempList列表集合对象中<br />
&nbsp;&nbsp;&nbsp;tempList.add(tempHash);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;close_DB_Object();// 关闭相关链接<br />
&nbsp;&nbsp;return tempList;// 返回填充完毕的数组列表集合对象<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 从数据库得到存储过程信息<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @return 数组列表对象<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;private ArrayList&lt;HashMap&lt;Object, Object&gt;&gt; getProcedureInfo(String procName)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;return this.executeSql("select Syscolumns.isoutparam as Way,systypes.name as TypeName from sysobjects,syscolumns,systypes where systypes.xtype=syscolumns.xtype and syscolumns.id=sysobjects.id and sysobjects.name='"<br />
&nbsp;&nbsp;&nbsp;&nbsp;+ procName + "' order by Syscolumns.isoutparam");<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 从数据库得到存储过程参数个数<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @return 数组列表对象<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;@SuppressWarnings("unused")<br />
&nbsp;private int getParametersCount(String procName) throws Exception {<br />
&nbsp;&nbsp;int returnVal = 0;<br />
&nbsp;&nbsp;for (HashMap&lt;Object, Object&gt; tempHas : this<br />
&nbsp;&nbsp;&nbsp;&nbsp;.executeSql("select count(*) as RowsCount from sysobjects,syscolumns,systypes where systypes.xtype=syscolumns.xtype and syscolumns.id=sysobjects.id and sysobjects.name='"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ procName + "'")) {<br />
&nbsp;&nbsp;&nbsp;returnVal = Integer.parseInt(tempHas.get("ROWSCOUNT").toString());<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return returnVal;<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 得到调用存储过程的全名<br />
&nbsp; * <br />
&nbsp; * @param procName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 存储过程名称<br />
&nbsp; * @return 调用存储过程的全名<br />
&nbsp; * @throws Exception<br />
&nbsp; */<br />
&nbsp;private String getProcedureCallName(String procName, int prametCount)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;String procedureCallName = "{call " + procName;<br />
&nbsp;&nbsp;for (int i = 0; i &lt; prametCount; i++) {<br />
&nbsp;&nbsp;&nbsp;if (0 == i) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;procedureCallName = procedureCallName + "(?";<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;if (0 != i) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;procedureCallName = procedureCallName + ",?";<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;procedureCallName = procedureCallName + ")}";<br />
&nbsp;&nbsp;return procedureCallName;<br />
&nbsp;}</p>
<p>&nbsp;/**<br />
&nbsp; * 得到数据类型的整型值<br />
&nbsp; * <br />
&nbsp; * @param typeName<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 类型名称<br />
&nbsp; * @return 数据类型的整型值<br />
&nbsp; */<br />
&nbsp;private int getDataType(String typeName) {<br />
&nbsp;&nbsp;if (typeName.equals("varchar"))<br />
&nbsp;&nbsp;&nbsp;return Types.VARCHAR;<br />
&nbsp;&nbsp;if (typeName.equals("int"))<br />
&nbsp;&nbsp;&nbsp;return Types.INTEGER;<br />
&nbsp;&nbsp;if (typeName.equals("bit"))<br />
&nbsp;&nbsp;&nbsp;return Types.BIT;<br />
&nbsp;&nbsp;if (typeName.equals("float"))<br />
&nbsp;&nbsp;&nbsp;return Types.FLOAT;<br />
&nbsp;&nbsp;return 0;<br />
&nbsp;}</p>
<p>&nbsp;// 设置驱动路径<br />
&nbsp;@SuppressWarnings("static-access")<br />
&nbsp;public void set_DRIVER(String _DRIVER) {<br />
&nbsp;&nbsp;this._DRIVER = _DRIVER;<br />
&nbsp;}</p>
<p>&nbsp;// 设置数据库密码<br />
&nbsp;@SuppressWarnings("static-access")<br />
&nbsp;public void set_PASSWORD(String _PASSWORD) {<br />
&nbsp;&nbsp;this._PASSWORD = _PASSWORD;<br />
&nbsp;}</p>
<p>&nbsp;// 设置数据库连接字符串<br />
&nbsp;@SuppressWarnings("static-access")<br />
&nbsp;public void set_URL(String _URL) {<br />
&nbsp;&nbsp;this._URL = _URL;<br />
&nbsp;}</p>
<p>&nbsp;// 设置数据库用户名<br />
&nbsp;@SuppressWarnings("static-access")<br />
&nbsp;public void set_USER_NA(String _USER_NA) {<br />
&nbsp;&nbsp;this._USER_NA = _USER_NA;<br />
&nbsp;}</p>
<p>}<br />
</p>
<img src ="http://www.blogjava.net/hnicypb/aggbug/226725.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hnicypb/" target="_blank">Sky Yi</a> 2008-09-03 17:19 <a href="http://www.blogjava.net/hnicypb/articles/226725.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>