﻿<?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-◎ヤ撧吥菔瀭o┊。</title><link>http://www.blogjava.net/hllwuxin/</link><description>刪除昨天啲煩惱.﹖選擇今天啲快樂.﹖設置明天啲幸福.﹖ </description><language>zh-cn</language><lastBuildDate>Mon, 18 May 2026 14:52:35 GMT</lastBuildDate><pubDate>Mon, 18 May 2026 14:52:35 GMT</pubDate><ttl>60</ttl><item><title>[转]MyEclipse7.1插件安装 </title><link>http://www.blogjava.net/hllwuxin/archive/2009/09/08/294335.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Tue, 08 Sep 2009 09:23:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2009/09/08/294335.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/294335.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2009/09/08/294335.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/294335.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/294335.html</trackback:ping><description><![CDATA[<p>最近刚使用MyEclise 7.1 ，发现期插件安装与以前有所不同。 </p>
<p>MyEclipse 7.1 的安装目录结构如下： </p>
<p>view plaincopy to clipboardprint?<br />
1. Genuitec&nbsp;&nbsp;&nbsp;&nbsp; <br />
2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─Common&nbsp;&nbsp;&nbsp;&nbsp; <br />
3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─configuration&nbsp;&nbsp;&nbsp;&nbsp; <br />
4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─features&nbsp;&nbsp;&nbsp;&nbsp; <br />
5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; └─plugins&nbsp;&nbsp;&nbsp;&nbsp; <br />
6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─MyEclipse 7.1&nbsp;&nbsp;&nbsp;&nbsp; <br />
7.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─configuration&nbsp;&nbsp;&nbsp;&nbsp; <br />
8.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─dropins&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp; 1. Genuitec&nbsp; <br />
&nbsp;&nbsp; 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─Common&nbsp; <br />
&nbsp;&nbsp; 3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─configuration&nbsp; <br />
&nbsp;&nbsp; 4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─features&nbsp; <br />
&nbsp;&nbsp; 5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; └─plugins&nbsp; <br />
&nbsp;&nbsp; 6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─MyEclipse 7.1&nbsp; <br />
&nbsp;&nbsp; 7.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─configuration&nbsp; <br />
&nbsp;&nbsp; 8.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─dropins&nbsp;&nbsp; 最新的插件安装方式，要求将插件安装在上图中的dropins节点。并且要求以如下结构安装 </p>
<p>dropins--&gt;插件文件夹(可由安装者定制)--&gt;eclipse--&gt;plugins+features </p>
<p>例如，我以fat插件作为安装示例，目录结构图如下： </p>
<p>view plaincopy to clipboardprint?<br />
&nbsp;1. Genuitec&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;2.&nbsp;&nbsp;&nbsp;&nbsp; ├─Common&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;3.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─configuration&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;4.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─features&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;5.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; └─plugins&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;6.&nbsp;&nbsp;&nbsp;&nbsp; └─MyEclipse 7.1&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;7.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─configuration&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;8.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─dropins&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;9.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─fat&nbsp;&nbsp;&nbsp;&nbsp; <br />
10.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─eclipse&nbsp;&nbsp;&nbsp;&nbsp; <br />
11.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─features&nbsp;&nbsp;&nbsp;&nbsp; <br />
12.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─plugins&nbsp;&nbsp;&nbsp;&nbsp; <br />
13.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─net.sf.fjep.fatjar_0.0.31(插件)&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp; 1. Genuitec&nbsp; <br />
&nbsp;&nbsp; 2.&nbsp;&nbsp;&nbsp;&nbsp; ├─Common&nbsp; <br />
&nbsp;&nbsp; 3.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─configuration&nbsp; <br />
&nbsp;&nbsp; 4.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; ├─features&nbsp; <br />
&nbsp;&nbsp; 5.&nbsp;&nbsp;&nbsp;&nbsp; │&nbsp; └─plugins&nbsp; <br />
&nbsp;&nbsp; 6.&nbsp;&nbsp;&nbsp;&nbsp; └─MyEclipse 7.1&nbsp; <br />
&nbsp;&nbsp; 7.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─configuration&nbsp; <br />
&nbsp;&nbsp; 8.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─dropins&nbsp; <br />
&nbsp;&nbsp; 9.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─fat&nbsp; <br />
&nbsp; 10.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─eclipse&nbsp; <br />
&nbsp; 11.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ├─features&nbsp; <br />
&nbsp; 12.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─plugins&nbsp; <br />
&nbsp; 13.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; └─net.sf.fjep.fatjar_0.0.31(插件)&nbsp;&nbsp; 安装好后重新启动MyEclipse7 .1 ,插件的效果就出来了--当然前提是你的插件支持当前eclipse版本。 </p>
<p>&nbsp;</p>
<p>本文来自CSDN博客，转载请标明出处：http://blog.csdn.net/guo_rui22/archive/2009/07/07/4327539.aspx</p>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/294335.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2009-09-08 17:23 <a href="http://www.blogjava.net/hllwuxin/archive/2009/09/08/294335.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse插件管理</title><link>http://www.blogjava.net/hllwuxin/archive/2008/07/13/214610.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Sun, 13 Jul 2008 11:31:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2008/07/13/214610.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/214610.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2008/07/13/214610.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/214610.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/214610.html</trackback:ping><description><![CDATA[<h3 class="" title=""><a href="http://harrison2010.javaeye.com/blog/161802">Eclipse插件管理</a></h3>
<div class="blog_content">
<p><span style="font-size: small">&nbsp;&nbsp;&nbsp;<strong> 提示：新下载的插件PlugIn一定不要都放在原始的Eclipse目录下去，一大堆，累死你：（</strong></span></p>
<ol>
    <li>前提是你已经下载解压并设置好Eclipse工具，比如解压在E:\OpenSource\Eclipse\目录下，以下这个目录以%ECLIPSE_HOME%来进行表示；
    <li>此时默认的插件是在%ECLIPSE_HOME%\plugins目录中的；
    <li>在%ECLIPSE_HOME%下建立一个PlugInsNew的目录；
    <p>　　比如：E:\OpenSource\Eclipse\PlugInsNew</p>
    <li>如果你下载了一个新的插件，比如叫做：XYZ
    <p>　　那么就在%ECLIPSE_HOME%\PlugInsNew\目录下建立XYZ目录，目录里面是eclipse目录，eclipse目录包含有features与plugins两个子目录；结构如下图所示：</p>
    <p align="center"><img height="410" alt="图1" src="http://dev2dev.bea.com.cn/images/image060810001.jpg" width="220" border="0" _counted="undefined" /></p>
    <li>把下载的新插件的文件放在以下相应目录中；
    <p>　　%ECLIPSE_HOME%\PlugInsNew\XYZ\eclipse\features</p>
    <p>　　%ECLIPSE_HOME%\PlugInsNew\ XYZ\eclipse\plugins</p>
    <li>建立相关的.link的文件；
    <p>　　然后在%ECLIPSE_HOME%\links目录里建立一个XYZ.link的文件</p>
    <p>　　内容如是：</p>
    <p>　　path=E:/OpenSource/Eclipse/PlugInsNew/XYZ</p>
    <p>　　就一行这样的路径指示而已。</p>
    <p>　　这样，如果你下载了多个插件就可以如法炮制建立多个Link文件，想加载哪个插件就把哪个插件的Link文件放到%ECLIPSE_HOME%\links的目录中即可，使用与管理都很方便，建议千万不要放在默认的安装目录中，这样对于升级Eclipse主程序也方便一些；当然如果你喜欢用Find and Install&#8230;进行安装的话也可以的；</p>
    <p>　　如果上面你的%ECLIPSE_HOME%与此不同，请修改XYZ.link文件里的路径。</p>
    <li>删除插件，先关闭Eclipse；
    <p>　　删除%ECLIPSE_HOME%\links\XYZ.link文件即可</p>
    <p>　　删除%ECLIPSE_HOME%\PlugInsNew\XYZ整个目录及文件</p>
    <li>重新启动Eclipse，这样就可以了。如果插件没有生效或者没有删除，请加上-clean进行启动Eclipse，即Eclipse.exe &#8211;clean
    <li>插件安装验证及记录详见：Eclipse的workspace下面的.metadata\.log文件，比如：%ECLIPSE_HOME%\workspace\.metadata\.log文件，有问题的话，打开这个文件看看并进行解决。
    <li>转载别人的，希望大家都能学习！！！</li>
</ol>
</div>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/214610.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2008-07-13 19:31 <a href="http://www.blogjava.net/hllwuxin/archive/2008/07/13/214610.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DBA必须熟悉的、最有用的DBA视图</title><link>http://www.blogjava.net/hllwuxin/archive/2007/10/12/152347.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Fri, 12 Oct 2007 06:48:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/10/12/152347.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/152347.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/10/12/152347.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/152347.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/152347.html</trackback:ping><description><![CDATA[dba_data_files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 关于数据库文件的信息
<p>dba_db_links&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中的所有数据库链路</p>
<p>dba_extents&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中包括所有分区</p>
<p>dba_free_space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 所有表空间中自由分区</p>
<p>dba_indexes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有索引的描述</p>
<p>dba_ind_columns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在所有表及聚族上压缩索引的列</p>
<p>dba_objects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有的对象</p>
<p>dba_rollback_segs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 回滚段的描述</p>
<p>dba_segments&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 为所有数据库段分配的存储空间</p>
<p>dba_sequences&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有顺序书的描述</p>
<p>dba_synonyms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有同义词</p>
<p>dba_tables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有表的描述</p>
<p>dba_tablespaces&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有表空间的描述</p>
<p>dba_tab_columns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 所有表描述、视图以及聚族的列</p>
<p>dba_tab_grants&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中对象所授的权限</p>
<p>dba_tab_privs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中对象所授的权限</p>
<p>dba_ts_quotas&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 所有用户表空间限额</p>
<p>dba_users&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 关于数据库的所有用户信息</p>
<p>dba_views&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数据库中所有视图</p>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/152347.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-10-12 14:48 <a href="http://www.blogjava.net/hllwuxin/archive/2007/10/12/152347.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>execute immediate</title><link>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152050.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Thu, 11 Oct 2007 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152050.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/152050.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152050.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/152050.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/152050.html</trackback:ping><description><![CDATA[<div>EXECUTE IMMEDIATE代替了以前Oracle8i中DBMS_SQL package包.它解析并马上执行动态的SQL语句或非运行时创建的PL/SQL块.动态创建和执行SQL语句性能超前，EXECUTE IMMEDIATE的目标在于减小企业费用并获得较高的性能，较之以前它相当容易编码.尽管DBMS_SQL仍然可用，但是推荐使用EXECUTE IMMEDIATE,因为它获的收益在包之上。</div>
<div><br />
使用技巧</div>
<div><br />
1. EXECUTE IMMEDIATE将不会提交一个DML事务执行，应该显式提交<br />
如果通过EXECUTE IMMEDIATE处理DML命令，那么在完成以前需要显式提交或者作为EXECUTE IMMEDIATE自己的一部分. 如果通过EXECUTE IMMEDIATE处理DDL命令,它提交所有以前改变的数据</div>
<div><br />
2. 不支持返回多行的查询,这种交互将用临时表来存储记录(参照例子如下)或者用REF cursors.</div>
<div><br />
3. 当执行SQL语句时，不要用分号，当执行PL/SQL块时，在其尾部用分号.</div>
<div><br />
4. 在Oracle手册中，未详细覆盖这些功能。下面的例子展示了所有用到Execute immediate的可能方面.希望能给你带来方便.</div>
<div><br />
5. 对于Forms开发者,当在PL/SQL 8.0.6.3.版本中，Forms 6i不能使用此功能.</div>
<div><br />
EXECUTE IMMEDIATE用法例子</div>
<div><br />
1. 在PL/SQL运行DDL语句</div>
<div><br />
begin<br />
execute immediate 'set role all';<br />
end;</div>
<div><br />
2. 给动态语句传值(USING 子句)</div>
<div><br />
declare<br />
l_depnam varchar2(20) := 'testing';<br />
l_loc varchar2(10) := 'Dubai';<br />
begin<br />
execute immediate 'insert into dept values (:1, :2, :3)'<br />
using 50, l_depnam, l_loc;<br />
commit;<br />
end;</div>
<div><br />
3. 从动态语句检索值(INTO子句)</div>
<div><br />
declare<br />
l_cnt varchar2(20);<br />
begin<br />
execute immediate 'select count(1) from emp'<br />
into l_cnt;<br />
dbms_output.put_line(l_cnt);<br />
end;</div>
<div><br />
4. 动态调用例程.例程中用到的绑定变量参数必须指定参数类型.?]认为IN类型,其它类型必须显式指定</div>
<div><br />
declare<br />
l_routin varchar2(100) := 'gen2161.get_rowcnt';<br />
l_tblnam varchar2(20) := 'emp';<br />
l_cnt number;<br />
l_status varchar2(200);<br />
begin<br />
execute immediate 'begin ' || l_routin || '(:2, :3, :4); end;'<br />
using in l_tblnam, out l_cnt, in out l_status;</div>
<div>if l_status != 'OK' then<br />
dbms_output.put_line('error');<br />
end if;<br />
end;</div>
<div><br />
5. 将返回值传递到PL/SQL记录类型;同样也可用%rowtype变量</div>
<div><br />
declare<br />
type empdtlrec is record (empno number(4),<br />
ename varchar2(20),<br />
deptno number(2));<br />
empdtl empdtlrec;<br />
begin<br />
execute immediate 'select empno, ename, deptno ' ||<br />
'from emp where empno = 7934'<br />
into empdtl;<br />
end;</div>
<div><br />
6. 传递并检索值.INTO子句用在USING子句前</div>
<div><br />
declare<br />
l_dept pls_integer := 20;<br />
l_nam varchar2(20);<br />
l_loc varchar2(20);<br />
begin<br />
execute immediate 'select dname, loc from dept where deptno = :1'<br />
into l_nam, l_loc<br />
using l_dept ;<br />
end;</div>
<div><br />
7. 多行查询选项.对此选项用insert语句填充临时表，用临时表进行进一步的处理,也可以用REF cursors纠正此缺憾.</div>
<div>declare<br />
l_sal pls_integer := 2000;<br />
begin<br />
execute immediate 'insert into temp(empno, ename) ' ||<br />
' select empno, ename from emp ' ||<br />
' where sal &gt; :1'<br />
using l_sal;<br />
commit;<br />
end;</div>
<div><br />
对于处理动态语句,EXECUTE IMMEDIATE比以前可能用到的更容易并且更高效.当意图执行动态语句时，适当地处理异常更加重要.应该关注于捕获所有可能的异常.<br />
</div>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/152050.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-10-11 15:21 <a href="http://www.blogjava.net/hllwuxin/archive/2007/10/11/152050.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DBA应遵循的oracle调优原则</title><link>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152044.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Thu, 11 Oct 2007 07:00:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152044.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/152044.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/10/11/152044.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/152044.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/152044.html</trackback:ping><description><![CDATA[<p style="text-indent: 2em">Oracle 调优是一个复杂的主题。关于调优可以写整整一本书，不过，为了改善 Oracle 数据库的性能，有一些基本的概念是每个 Oracle DBA 都应该遵从的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">在这篇简介中，我们将简要地介绍以下的 Oracle 主题：
<p style="text-indent: 2em">
<p style="text-indent: 2em">-- 外部调整：我们应该记住 Oracle 并不是单独运行的。因此我们将查看一下通过调整 Oracle 服务器以得到高的性能。
<p style="text-indent: 2em">
<p style="text-indent: 2em">--Row re-sequencing 以减少磁盘 I/O ：我们应该懂得 Oracle 调优最重要的目标是减少 I/O 。
<p style="text-indent: 2em">
<p style="text-indent: 2em">--Oracle SQL 调整。 Oracle SQL 调整是 Oracle 调整中最重要的领域之一，只要通过一些简单的 SQL 调优规则就可以大幅度地提升 SQL 语句的性能，这是一点都不奇怪的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">-- 调整 Oracle 排序：排序对于 Oracle 性能也是有很大影响的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">-- 调整 Oracle 的竞争：表和索引的参数设置对于 UPDATE 和 INSERT 的性能有很大的影响。
<p style="text-indent: 2em">
<p style="text-indent: 2em">我们首先从调整 Oracle 外部的环境开始。如果内存和 CPU 的资源不足的话，任何的 Oracle 调整都是没有帮助的。
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>外部的性能问题</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">Oracle 并不是单独运行的。 Oracle 数据库的性能和外部的环境有很大的关系。这些外部的条件包括有：
<p style="text-indent: 2em">
<p style="text-indent: 2em">． CPU--CPU 资源的不足令查询变慢。当查询超过了 Oracle 服务器的 CPU 性能时，你的数据库性能就受到 CPU 的限制。
<p style="text-indent: 2em">
<p style="text-indent: 2em">．内存 -- 可用于 Oralce 的内存数量也会影响 SQL 的性能，特别是在数据缓冲和内存排序方面。
<p style="text-indent: 2em">
<p style="text-indent: 2em">．网络 -- 大量的 Net8 通信令 SQL 的性能变慢。
<p style="text-indent: 2em">
<p style="text-indent: 2em">许多新手都错误的认为应该首先调整 Oracle 数据库，而不是先确认外部资源是否足够。实际上，如果外部环境出现瓶颈，再多的 Oracle 调整都是没有帮助的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">在检查 Oracle 的外部环境时，有两个方面是需要注意的：
<p style="text-indent: 2em">
<p style="text-indent: 2em">1 、当运行队列的数目超过服务器的 CPU 数量时，服务器的性能就会受到 CPU 的限制。补救的方法是为服务器增加额外的 CPU 或者关闭需要很多处理资源的组件，例如 Oracle Parallel Query 。
<p style="text-indent: 2em">
<p style="text-indent: 2em">2 、内存分页。当内存分页时，内存容量已经不足，而内存页是与磁盘上的交换区进行交互的。补救的方法是增加更多的内存，减少 Oracle SGA 的大小，或者关闭 Oracle 的多线程服务器。
<p style="text-indent: 2em">
<p style="text-indent: 2em">可以使用各种标准的服务器工具来得到服务器的统计数据，例如 vmstat,glance,top 和 sar 。 DBA 的目标是确保数据库服务器拥有足够的 CPU 和内存资源来处理 Oracle 的请求。
<p style="text-indent: 2em">
<p style="text-indent: 2em">以下让我们来看一下 Oracle 的 row-resequencing 是如何能够极大地减少磁盘 I/O 的。
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>Row-resequencing （行的重新排序）</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">就象我们上面提到的，有经验的 Oracle DBA 都知道 I/O 是响应时间的最大组成部分。其中磁盘 I/O 特别厉害，因为当 Oracle 由磁盘上的一个数据文件得到一个数据块时，读的进程就必须等待物理 I/O 操作完成。磁盘操作要比数据缓冲慢 10,000 倍。因此，如果可以令 I/O 最小化，或者减少由于磁盘上的文件竞争而带来的瓶颈，就可以大大地改善 Oracle 数据库的性能。
<p style="text-indent: 2em">
<p style="text-indent: 2em">如果系统响应很慢，通过减少磁盘 I/O 就可以有一个很快的改善。如果在一个事务中通过按一定的范围搜索 primary-key 索引来访问表，那么重新以 CTAS 的方法组织表将是你减少 I/O 的首要策略。通过在物理上将行排序为和 primary-key 索引一样的顺序，就可以加快获得数据的速度。
<p style="text-indent: 2em">
<p style="text-indent: 2em">就象磁盘的负载平衡一样，行的重新排序也是很简单的，而且也很快。通过与其它的 DBA 管理技巧一起使用，就可以在高 I/O 的系统中大大地减少响应的时间。
<p style="text-indent: 2em">
<p style="text-indent: 2em">在高容量的在线事务处理环境中（ online transaction processing ， OLTP ），数据是由一个 primary 索引得到的，重新排序表格的行就可以令连续块的顺序和它们的 primary 索引一样，这样就可以在索引驱动的表格查询中，减少物理 I/O 并且改善响应时间。这个技巧仅在应用选择多行的时候有用，或者在使用索引范围搜索和应用发出多个查询来得到连续的 key 时有效。对于随机的唯一 primary-key （主键）的访问将不会由行重新排序中得到好处。
<p style="text-indent: 2em">
<p style="text-indent: 2em">让我们看一下它是如何工作的。考虑以下的一个 SQL 的查询，它使用一个索引来得到 100 行：
<p style="text-indent: 2em">
<p style="text-indent: 2em">select salary from employee where last_name like 'B%';
<p style="text-indent: 2em">
<p style="text-indent: 2em">这个查询将会使用 last_name_index ，搜索其中的每一行来得到目标行。这个查询将会至少使用 100 次物理磁盘的读取，因为 employee 的行存放在不同的数据块中。
<p style="text-indent: 2em">
<p style="text-indent: 2em">不过，如果表中的行已经重新排序为和 last_name_index 的一样，同样的查询又会怎样处理呢？我们可以看到这个查询只需要三次的磁盘 I/O 就读完全部 100 个员工的资料（一次用作索引的读取，两次用作数据块的读取），减少了 97 次的块读取。
<p style="text-indent: 2em">
<p style="text-indent: 2em">重新排序带来的性能改善的程度在于在你开始的时候行的乱序性如何，以及你需要由序列中访问多少行。至于一个表中的行与索引的排序键的匹配程度，可以查看数据字典中的 dba_indexes 和 dba_tables 视图得到。
<p style="text-indent: 2em">
<p style="text-indent: 2em">在 dba_indexes 的视图中，查看 clustering_factor 列。如果 clustering_factor 的值和表中的块数目大致一样，那么你的表和索引的顺序是一样的。不过，如果 clustering_factor 的值接近表中的行数目，那就表明表格中的行和索引的顺序是不一样的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">行重新排序的作用是不可以小看的。在需要进行大范围的索引搜索的大表中，行重新排序可以令查询的性能提高三倍。
<p style="text-indent: 2em">
<p style="text-indent: 2em">一旦你已经决定重新排序表中的行，你可以使用以下的工具之一来重新组织表格。
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 使用 Oracle 的 Create Table As Select (CTAS) 语法来拷贝表格
<p style="text-indent: 2em">
<p style="text-indent: 2em">. Oracle9i 自带的表格重新组织工具
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>SQL 调优</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">Oracle 的 SQL 调优是一个复杂的主题，甚至是需要整本书来介绍 Oracle SQL 调优的细微差别。不过有一些基本的规则是每个 Oracle DBA 都需要跟从的，这些规则可以改善他们系统的性能。 SQL 调优的目标是简单的：
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 消除不必要的大表全表搜索：不必要的全表搜索导致大量不必要的 I/O ，从而拖慢整个数据库的性能。调优专家首先会根据查询返回的行数目来评价 SQL 。在一个有序的表中，如果查询返回少于 40% 的行，或者在一个无序的表中，返回少于 7% 的行，那么这个查询都可以调整为使用一个索引来代替全表搜索。对于不必要的全表搜索来说，最常见的调优方法是增加索引。可以在表中加入标准的 B 树索引，也可以加入 bitmap 和基于函数的索引。要决定是否消除一个全表搜索，你可以仔细检查索引搜索的 I/O 开销和全表搜索的开销，它们的开销和数据块的读取和可能的并行执行有关，并将两者作对比。在一些情况下，一些不必要的全表搜索的消除可以通过强制使用一个 index 来达到，只需要在 SQL 语句中加入一个索引的提示就可以了。
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 在全表搜索是一个最快的访问方法时，将小表的全表搜索放到缓存中，调优专家应该确保有一个专门的数据缓冲用作行缓冲。在 Oracle7 中，你可以使用 alter table xxx cache 语句，在 Oracle8 或以上，小表可以被强制为放到 KEEP 池中缓冲。
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 确保最优的索引使用 ：对于改善查询的速度，这是特别重要的。有时 Oracle 可以选择多个索引来进行查询，调优专家必须检查每个索引并且确保 Oracle 使用正确的索引。它还包括 bitmap 和基于函数的索引的使用。
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 确保最优的 JOIN 操作：有些查询使用 NESTED LOOP join 快一些，有些则是 HASH join 快一些，另外一些则是 sort-merge join 更快。
<p style="text-indent: 2em">
<p style="text-indent: 2em">这些规则看来简单，不过它们占 SQL 调优任务的 90% ，并且它们也无需完全懂得 Oracle SQL 的内部运作。以下我们来简单概览以下 Oracle SQL 的优化。
<p style="text-indent: 2em">
<p style="text-indent: 2em">我们首先简要查看 Oracle 的排序，并且看一看排序操作是如何影响性能的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">调整 Oracle 的排序操作
<p style="text-indent: 2em">
<p style="text-indent: 2em">排序是 SQL 语法中一个小的方面，但很重要，在 Oracle 的调整中，它常常被忽略。当使用 create index 、 ORDER BY 或者 GROUP BY 的语句时， Oracle 数据库将会自动执行排序的操作。通常，在以下的情况下 Oracle 会进行排序的操作：
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>使用 Order by / Group by 的 SQL 语句</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">在创建索引的时候:
<p style="text-indent: 2em">
<p style="text-indent: 2em">进行 table join 时，由于现有索引的不足而导致 SQL 优化器调用 MERGE SORT。
<p style="text-indent: 2em">
<p style="text-indent: 2em">当与 Oracle 建立起一个 session 时，在内存中就会为该 session 分配一个私有的排序区域。如果该连接是一个专用的连接 (dedicated connection) ，那么就会根据 init.ora 中 sort_area_size 参数的大小在内存中分配一个 Program Global Area (PGA) 。如果连接是通过多线程服务器建立的，那么排序的空间就在 large_pool 中分配。不幸的是，对于所有的 session ，用做排序的内存量都必须是一样的，我们不能为需要更大排序的操作分配额外的排序区域。因此，设计者必须作出一个平衡，在分配足够的排序区域以避免发生大的排序任务时出现磁盘排序（ disk sorts ）的同时，对于那些并不需要进行很大排序的任务，就会出现一些浪费。当然，当排序的空间需求超出了 sort_area_size 的大小时，这时将会在 TEMP 表空间中分页进行磁盘排序。磁盘排序要比内存排序大概慢 14,000 倍。
<p style="text-indent: 2em">
<p style="text-indent: 2em">上面我们已经提到，私有排序区域的大小是有 init.ora 中的 sort_area_size 参数决定的。每个排序所占用的大小由 init.ora 中的 sort_area_retained_size 参数决定。当排序不能在分配的空间中完成时，就会使用磁盘排序的方式，即在 Oracle 实例中的临时表空间中进行。
<p style="text-indent: 2em">
<p style="text-indent: 2em">磁盘排序的开销是很大的，有几个方面的原因。首先，和内存排序相比较，它们特别慢；而且磁盘排序会消耗临时表空间中的资源。 Oracle 还必须分配缓冲池块来保持临时表空间中的块。无论什么时候，内存排序都比磁盘排序好，磁盘排序将会令任务变慢，并且会影响 Oracle 实例的当前任务的执行。还有，过多的磁盘排序将会令 free buffer waits 的值变高，从而令其它任务的数据块由缓冲中移走。
<p style="text-indent: 2em">
<p style="text-indent: 2em">接着，让我们看一下 Oracle 的竞争，并且看一下表的存储参数的设置是如何影响 SQL UPDATE 和 INSERT 语句的性能的。
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>调整 Oracle 的竞争</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">Oracle 的其中一个优点时它可以管理每个表空间中的自由空间。 Oracle 负责处理表和索引的空间管理，这样就可以让我们无需懂得 Oracle 的表和索引的内部运作。不过，对于有经验的 Oracle 调优专家来说，他需要懂得 Oracle 是如何管理表的 extent 和空闲的数据块。对于调整拥有高的 insert 或者 update 的系统来说，这是非常重要的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">要精通对象的调整，你需要懂得 freelists 和 freelist 组的行为，它们和 pctfree 及 pctused 参数的值有关。这些知识对于企业资源计划（ ERP ）的应用是特别重要的，因为在这些应用中，不正确的表设置通常是 DML 语句执行慢的原因。
<p style="text-indent: 2em">
<p style="text-indent: 2em">对于初学者来说，最常见的错误是认为默认的 Oracle 参数对于所有的对象都是最佳的。除非磁盘的消耗不是一个问题，否则在设置表的 pctfree 和 pctused 参数时，就必须考虑平均的行长和数据库的块大小，这样空的块才会被有效地放到 freelists 中。当这些设置不正确时，那些得到的 freelists 也是 &#8220;dead&#8221;块，因为它们没有足够的空间来存储一行，这样将会导致明显的处理延迟。
<p style="text-indent: 2em">
<p style="text-indent: 2em">Freelists 对于有效地重新使用 Oracle 表空间中的空间是很重要的，它和 pctfree 及 pctused 这两个存储参数的设置直接相关。通过将 pctused 设置为一个高的值，这时数据库就会尽快地重新使用块。
<p style="text-indent: 2em">当有一个请求需要插入一行到表格中时， Oracle 就会到 freelist 中寻找一个有足够的空间来容纳一行的块。你也许知道， freelist 串是放在表格或者索引的第一个块中，这个块也被称为段头（ segment header ）。 pctfree 和 pctused 参数的唯一目的就是为了控制块如何在 freelists 中进出。虽然 freelist link 和 unlink 是简单的 Oracle 功能，不过设置 freelist link (pctused) 和 unlink (pctfree) 对 Oracle 的性能确实有影响。
<p style="text-indent: 2em">
<p style="text-indent: 2em">由 DBA 的基本知识知道， pctfree 参数是控制 freelist un-links 的（即将块由 freelists 中移除）。设置 pctfree=10 意味着每个块都保留 10% 的空间用作行扩展。 pctused 参数是控制 freelist re-links 的。设置 pctused=40 意味着只有在块的使用低于 40% 时才会回到表格的 freelists 中。
<p style="text-indent: 2em">
<p style="text-indent: 2em">许多新手对于一个块重新回到 freelists 后的处理都有些误解。其实，一旦由于一个删除的操作而令块被重新加入到 freelist 中，它将会一直保留在 freelist 中即使空间的使用超过了 60% ，只有在到达 pctfree 时才会将数据块由 freelist 中移走。
<p style="text-indent: 2em">
<p style="text-indent: 2em"><strong>表格和索引存储参数设置的要求总结</strong>
<p style="text-indent: 2em">
<p style="text-indent: 2em">以下的一些规则是用来设置 freelists, freelist groups, pctfree 和 pctused 存储参数的。你也知道， pctused 和 pctfree 的值是可以很容易地通过 alter table 命令修改的，一个好的 DBA 应该知道如何设置这些参数的最佳值。
<p style="text-indent: 2em">
<p style="text-indent: 2em">有效地使用空间和高性能之间是有矛盾的，而表格的存储参数就是控制这个方面的矛盾：
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 对于需要有效地重新使用空间，可以设置一个高的 pctused 值，不过副作用是需要额外的 I/O 。一个高的 pctused 值意味着相对满的块都会放到 freelist 中。因此，这些块在再次满之前只可以接受几行记录，从而导致更多的 I/O 。
<p style="text-indent: 2em">
<p style="text-indent: 2em">. 追求高性能的话，可以将 pctused 设置为一个低的值，这意味着 Oracle 不会将数据块放到 freelists 中直到它几乎是空的。那么块将可以在满之前接收更多的行，因此可以减少插入操作的 I/O 。要记住 Oracle 扩展新块的性能要比重新使用现有的块高。对于 Oracle 来说，扩展一个表比管理 freelists 消耗更少的资源。
<p style="text-indent: 2em">
<p style="text-indent: 2em">让我们来回顾一下设置对象存储参数的一些常见规则：
<p style="text-indent: 2em">
<p style="text-indent: 2em">．经常将 pctused 设置为可以接收一条新行。对于不能接受一行的 free blocks 对于我们来说是没有用的。如果这样做，将会令 Oracle 的性能变慢，因为 Oracle 将在扩展表来得到一个空的块之前，企图读取 5 个 &#8220;dead&#8221;的 free block 。
<p style="text-indent: 2em">
<p style="text-indent: 2em">．表格中 chained rows 的出现意味着 pctfree 太低或者是 db_block_size 太少。在很多情况下， RAW 和 LONG RAW 列都很巨大，以至超过了 Oracle 的最大块的大小，这时 chained rows 是不可以避免的。
<p style="text-indent: 2em">
<p style="text-indent: 2em">．如果一个表有同时插入的 SQL 语句，那么它需要有同时删除的语句。运行单一个一个清除的工作将会把全部的空闲块放到一个 freelist 中，而没有其它包含有任何空闲块的 freelists 出现。
<p style="text-indent: 2em">
<p style="text-indent: 2em">． freelist 参数应该设置为表格同时更新的最大值。例如，如果在任何时候，某个表最多有 20 个用户执行插入的操作，那么该表的参数应该设置为 freelists=20 。
<p style="text-indent: 2em">
<p style="text-indent: 2em">应记住的是 freelist groups 参数的值只是对于 Oracle Parallel Server 和 Real Application Clusters 才是有用的。对于这类 Oracle ， freelist groups 应该设置为访问该表格的 Oracle Parallel Server 实例的数目。</p>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/152044.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-10-11 15:00 <a href="http://www.blogjava.net/hllwuxin/archive/2007/10/11/152044.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于oracle中的空值</title><link>http://www.blogjava.net/hllwuxin/archive/2007/10/11/151981.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Thu, 11 Oct 2007 03:14:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/10/11/151981.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/151981.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/10/11/151981.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/151981.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/151981.html</trackback:ping><description><![CDATA[<p><span style="color: #000000">在 数 据 库 中， 空 值 用 来 表 示 实 际 值 未 知 或 无 意 义 的 情 况。 在一 个 表 中， 如 果 一 行 中 的 某 列 没 有 值， 那 么 就 称 它 为 空 值（NULL）。 任 何 数 据 类 型 的 列, 只 要 没 有 使 用 非 空（NOT NULL） 或 主 键（PRIMARY KEY） 完 整 性 限 制， 都 可 以 出 现 空 值。在 实 际 应 用 中， 如 果 忽 略 空 值 的 存 在， 将 会 造 成 造 成 不 必 要 的 麻 烦。 </span>
<p><span style="color: #000000">---- 例 如， 在 下 面 的 雇 员 表（EMP） 中， 雇 员 名（ENAME）为KING 的 行， 因 为KING 为 最 高 官 员（PRESIDENT）， 他 没 有 主 管（MGR）， 所 以 其MGR 为 空值。 因 为 不 是 所 有 的 雇 员 都 有 手 续 费（COMM）， 所 以 列COMM 允 许 有 空 值，除300、500、1400、0 以 外 的 其 它 各 行COMM 均 为 空 值。 </span></p>
<pre><span style="color: #000000">EMPNO ENAME    JOB       MGR HIREDATE    SAL   COMM  DEPTNO<br />
---- -------- -------- --------- -------- ------ ---------<br />
7369 SMITH     CLERK     7902 17-DEC-80  800           20<br />
7499 ALLEN     SALESMAN  7698 20-FEB-81  1600    300   30<br />
7521 WARD      SALESMAN  7698 22-FEB-81  1250    500   30<br />
7566 JONES     MANAGER   7839 02-APR-81  2975          20<br />
7654 MARTIN    SALESMAN  7698 28-SEP-81  1250   1400   30<br />
7698 BLAKE     MANAGER   7839 01-MAY-81  2850          30<br />
7782 CLARK     MANAGER   7839 09-JUN-81  2450          10<br />
7788 SCOTT     ANALYST   7566 09-DEC-82  3000          20<br />
7839 KING      PRESIDENT      17-NOV-81  5000          10<br />
7844 TURNER    SALESMAN  7698 08-SEP-81  1500      0   30<br />
7876 ADAMS     CLERK     7788 12-JAN-83  1100          20<br />
7900 JAMES     CLERK     7698 03-DEC-81   950          30<br />
7902 FORD      ANALYST   7566 03-DEC-81  3000          20<br />
7934 MILLER    CLERK     7782 23-JAN-82  1300          10<br />
</span></pre>
<p><span style="color: #000000">---- 本 文 将 以 上 述EMP 表 为 例， 具 体 讨 论 一 下 空 值 在 日 常 应 用 中 所 具 有 的 一 些 特 性。 </span></p>
<p><span style="color: #000000">---- 一、 空 值 的 生 成 及 特 点 </span></p>
<p><span style="color: #000000">---- 1. 空 值 的 生 成 </span></p>
<p><span style="color: #000000">---- 如 果 一 列 没 有 非 空（NOT NULL） 完 整 性 限 制， 那 么 其 缺 省 的 值 为 空 值， 即 如 果 插 入 一 行 时 未 指 定 该 列 的 值， 则 其 值 为 空 值。 </span></p>
<p><span style="color: #000000">---- 使 用SQL 语 句INSERT 插 入 行， 凡 未 涉 及 到 的列， 其 值 为 空 值； 涉 及 到 的 列， 如 果 其 值 确 实 为 空 值， 插 入 时 可 以 用NULL 来 表 示（ 对 于字 符 型 的 列， 也 可 以 用'' 来 表 示）。 </span></p>
<p><span style="color: #000000">---- 例： 插 入 一 行， 其EMPNO 为1、ENAME 为'JIA'、SAL 为10000、job 和comm 为 空 值。 </span></p>
<pre><span style="color: #000000">SQL &gt;insert into emp(empno,ename,job,sal,comm) <br />
values(1,'JIA',NULL,1000,NULL);<br />
SQL &gt;select * from emp where empno=1;<br />
EMPNO ENAME  JOB   MGR HIREDATE    SAL    COMM    DEPTNO<br />
--------- ---------- --------- --------- --------- ---------<br />
1 JIA         1000<br />
</span></pre>
<p><span style="color: #000000">---- 可 以 看 到 新 插 入 的 一 行， 除job 和comm 为 空 值 外，mgr、hiredate、deptno 三 列 由 于 插 入 时 未 涉 及， 也 为 空 值。 </span></p>
<p><span style="color: #000000">---- 使 用SQL 语 句UPDATE 来 修 改 数 据， 空 值 可 用NULL 来 表 示（ 对 于 字 符 型 的 列， 也 可 以 用'' 来 表 示）。 例: </span></p>
<pre><span style="color: #000000">SQL &gt;update emp set ename=NULL,sal=NULL where empno=1;<br />
</span></pre>
<p><span style="color: #000000">---- 2. 空 值 的 特 点 </span></p>
<p><span style="color: #000000">---- 空 值 具 有 以 下 特 点： </span></p>
<p><span style="color: #000000">---- * 等 价 于 没 有 任 何 值。 </span></p>
<p><span style="color: #000000">---- * 与 0、 空 字 符 串 或 空 格 不 同。 </span></p>
<p><span style="color: #000000">---- * 在where 条 件 中, Oracle 认 为 结 果 为NULL 的 条 件 为FALSE， 带 有 这 样 条 件 的select 语 句 不 返 回 行， 并 且 不 返 回 错 误 信 息。 但NULL 和FALSE 是 不 同 的。 </span></p>
<p><span style="color: #000000">---- * 排 序 时 比 其 他 数 据 都 大。 </span></p>
<p><span style="color: #000000">---- * 空 值 不 能 被 索 引。 </span></p>
<p><span style="color: #000000">---- 二、 空 值 的 测 试 </span></p>
<p><span style="color: #000000">---- 因 为 空 值 表 示 缺 少 数 据， 所 以 空 值 和 其 它 值没 有 可 比 性， 即 不 能 用 等 于、 不 等 于、 大 于 或 小 于 和 其 它 数 值 比 较， 当 然 也 包 括 空 值 本身（ 但 是 在decode 中 例 外， 两 个 空 值 被 认 为 是 等 价）。 测 试 空 值 只 能 用 比 较 操 作 符IS NULL 和IS NOT NULL。 如 果 使 用 带 有 其 它 比 较 操 作 符 的 条 件 表 达 式， 并 且 其 结 果 依 赖于 空 值， 那 么 其 结 果 必 定 是NULL。 在where 条 件 中，Oracle 认 为 结 果 为NULL 的 条 件为FALSE， 带 有 这 样 条 件 的select 语 句 不 返 回 行， 也 不 返 回 错 误 信 息。 </span></p>
<p><span style="color: #000000">---- 例 如 查 询EMP 表 中MGR 为NULL 的 行： </span></p>
<pre><span style="color: #000000">SQL &gt;select * from emp where mgr='';  <br />
no rows selected<br />
SQL &gt;select * from emp where mgr=null;  <br />
no rows selected<br />
SQL &gt;select * from emp where mgr is null;<br />
EMPNO ENAME  JOB  MGR HIREDATE   SAL  COMM  DEPTNO<br />
---------- --------- --------- --------- ---------<br />
7839 KING  PRESIDENT  17-NOV-81  5000        10<br />
</span></pre>
<p><span style="color: #000000">---- 第1、2 句 写 法 不 妥，WHERE 条 件 结 果 为NULL， 不 返 回 行。 第 三 句 正 确， 返 回MGR 为 空 值 的 行。 </span></p>
<p><span style="color: #000000">---- 三、 空 值 和 操 作 符 </span></p>
<p><span style="color: #000000">---- 1. 空 值 和 逻 辑 操 作 符 </span></p>
<p><span style="color: #000000">---- 逻 辑 操 作 符 </span></p>
<p><span style="color: #000000">---- 表 达 式 </span></p>
<p><span style="color: #000000">---- 结 果 </span></p>
<pre><span style="color: #000000">AND<br />
NULL AND TRUE<br />
NULL<br />
<br />
NULL AND FALSE<br />
FALSE<br />
<br />
NULL AND NULL<br />
NULL<br />
OR<br />
NULL OR TRUE<br />
TRUE<br />
<br />
NULL OR FALSE<br />
NULL<br />
<br />
NULL OR NULL<br />
NULL<br />
NOT<br />
NOT NULL<br />
NULL<br />
</span></pre>
<p><span style="color: #000000">---- 可 以 看 到， 在 真 值 表 中， 除NULL AND FALSE 结 果 为FALSE、NULL OR TRUE 结 果 为TRUE 以 外， 其 它 结 果 均 为NULL。 </span></p>
<p><span style="color: #000000">---- 虽 然 在where 条 件 中，Oracle 认 为 结 果 为NULL 的WHERE 条 件 为FALSE， 但 在 条 件 表 达 式 中NULL 不 同 于FALSE。 例 如 在NOT （ NULL AND FALSE ） 和NOT （ NULL AND NULL ） 二 者 中 仅 有 一 处FALSE 和TRUE 的 区 别， 但NOT （ NULL AND FALSE ） 的 结 果 为 TRUE， 而NOT （ NULL AND NULL ） 的 结 果 为NULL。 </span></p>
<p><span style="color: #000000">---- 下 面 举 例 说 明 空 值 和 逻 辑 操 作 符 的 用 法： </span></p>
<pre><span style="color: #000000">SQL &gt; select * from emp where not comm=null and comm!=0;<br />
no rows selected<br />
SQL &gt; select * from emp where not ( not comm=null and comm!=0 );<br />
EMPNO ENAME  JOB      MGR  HIREDATE  SAL  COMM  DEPTNO<br />
---------- --------- --------- --------- ---------<br />
7844 TURNER SALESMAN  7698 08-SEP-81 1500   0     30<br />
</span></pre>
<p><span style="color: #000000">---- 第 一 个Select 语 句， 条 件"not comm=null and comm!=0" 等 价 于NULL AND COMM!=0。 对 于 任 意 一 行， 如 果COMM 为 不 等 于0 的 数 值， 条件 等 价 于NULL AND TRUE， 结 果 为NULL； 如 果COMM 等 于0， 条 件 等 价 于NULL AND FALSE，结 果 为FALSE。 所 以， 最 终 结 果 不 返 回 行。 </span></p>
<p><span style="color: #000000">---- 第 二 个Select 语 句 的 条 件 为 第 一 个Select 语句 条 件 的" 非"（NOT）， 对 于 任 意 一 行， 如 果COMM 为 不 等 于0 的 数 值， 条 件 等 价 于NOT NULL， 结 果 为NULL； 如 果COMM 等 于0， 条 件 等 价 于NOT FALSE， 结 果 为TRUE。 所 以， 最 终结 果 返 回 行COMM 等 于0 的 行。 </span></p>
<p><span style="color: #000000">---- 2. 空 值 和 比 较 操 作 符 </span></p>
<p><span style="color: #000000">---- （1）IS [NOT] NULL： 是 用 来 测 试 空 值 的 唯 一 操 作 符（ 见" 空 值 的 测 试"）。 </span></p>
<pre><span style="color: #000000">（2）=、!=、&gt;=、&lt;=、&gt;、&lt;<br />
SQL &gt;select ename,sal,comm from emp where sal &gt;comm;<br />
ENAME            SAL      COMM<br />
---------- --------- ---------<br />
ALLEN           1600       300<br />
WARD            1250       500<br />
TURNER          1500         0<br />
</span></pre>
<p><span style="color: #000000">---- sal 或comm 为 空 值 的 行，sal&gt;comm 比 较 结 果 为NULL， 所 以 凡 是sal 或comm 为 空 值 的 行 都 没 有 返 回。 </span></p>
<p><span style="color: #000000">---- （3）IN 和NOT IN 操 作 符 </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,mgr from emp where mgr in (7902,NULL);<br />
ENAME            MGR<br />
---------- ---------<br />
SMITH           7902<br />
</span></pre>
<p><span style="color: #000000">---- 在 上 述 语 句 中， 条 件"mgr in (7902,NULL)" 等 价于mgr=7902 or mgr=NULL。 对 于 表EMP 中 的 任 意 一 行， 如 果mgr 为NULL， 则 上 述 条 件 等价 于NULL OR NULL， 即 为NULL； 如 果mgr 为 不 等 于7902 的 数 值， 则 上 述 条 件 等 价于FALSE OR NULL， 即 为NULL； 如 果mgr 等 于7902， 则 上 述 条 件 等 价 于TRUE OR NULL， 即为TRUE。 所 以， 最 终 结 果 能 返 回mgr 等 于7902 的 行。 </span></p>
<pre><span style="color: #000000">SQL &gt;select deptno from emp where deptno not in ('10',NULL);<br />
no rows selected<br />
</span></pre>
<p><span style="color: #000000">---- 在 上 述 语 句 中， 条 件"deptno not in ('10',NULL)" 等 价 于deptno!='10' and deptno!=NULL， 对 于EMP 表 中 的 任 意 一 行，条 件 的 结 果 只 能 为NULL 或FALSE， 所 以 不 返 回 行。 </span></p>
<p><span style="color: #000000">---- （4）any,some </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,sal from emp where sal &gt; any(3000,null);<br />
ENAME            SAL<br />
---------- ---------<br />
KING            5000<br />
</span></pre>
<p><span style="color: #000000">---- 条 件"sal &gt; any(3000,null)" 等 价 于sal &gt;3000 or sal &gt;null。 类 似 前 述（3） 第 一 句， 最 终 结 果 返 回 所 有sal &gt;3000 的 行。 </span></p>
<p><span style="color: #000000">---- （5）All </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,sal from emp where sal &gt; all(3000,null);<br />
no rows selected<br />
</span></pre>
<p><span style="color: #000000">---- 条 件"sal&gt; all(3000,null)" 等 价 于sal &gt;3000 and sal &gt;null, 结 果 只 能 为NULL 或FALSE， 所 以 不 返 回 行。 </span></p>
<p><span style="color: #000000">---- （6）（not）between </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,sal from emp where sal between null and 3000;<br />
no rows selected<br />
</span></pre>
<p><span style="color: #000000">---- 条 件"sal between null and 3000" 等 价 于sal &gt;=null and sal&lt; =3000, 结 果 只 能 为NULL 或FALSE， 所 以 不 返 回 行。 </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,sal from emp where sal not between null and 3000;<br />
ENAME            SAL<br />
---------- ---------<br />
KING            5000<br />
</span></pre>
<p><font color="#a52a2a"><span style="color: #000000">---- 条 件"sal not between null and 3000" 等 价 于sal<null sal="" or="">3000, 类 似 前 述（3） 的 第 一 句， 结 果 返 回sal&gt;3000 的 行。 </null></span></font></p>
<p><span style="color: #000000">---- 下 表 为 比 较 操 作 符 和 空 值 的 小 结： </span></p>
<p><span style="color: #000000">---- 比 较 操 作 符 </span></p>
<p><span style="color: #000000">---- 表 达 式（ 例：A、B 是NULL、C=10） </span></p>
<p><span style="color: #000000">---- 结 果 </span></p>
<pre><span style="color: #000000">IS NULL、IS NOT NULL<br />
A IS NULL<br />
TRUE<br />
<br />
A IS NOT NULL<br />
FALSE<br />
<br />
C IS NULL<br />
FALSE<br />
<br />
C IS NOT NULL<br />
TRUE<br />
=、!=、&gt;=、&lt; =、&gt;、&lt; <br />
A = NULL<br />
NULL<br />
<br />
A &gt; NULL<br />
NULL<br />
<br />
C = NULL<br />
NULL<br />
<br />
C &gt; NULL<br />
NULL<br />
IN (=ANY)<br />
A IN (10,NULL)<br />
NULL<br />
<br />
C IN (10,NULL)<br />
TRUE<br />
<br />
C IN (20,NULL)<br />
NULL<br />
NOT IN <br />
( 等 价 于 ！=ALL)<br />
A NOT IN (20,NULL)<br />
NULL<br />
<br />
C NOT IN (20,NULL)<br />
FALSE<br />
<br />
C NOT IN (10,NULL)<br />
NULL<br />
ANY，SOME<br />
A &gt; ANY(5,NULL)<br />
NULL<br />
<br />
C &gt; ANY(5,NULL)<br />
TRUE<br />
<br />
C &gt; ANY(15,NULL)<br />
NULL<br />
ALL<br />
A &gt; ALL(5,NULL)<br />
NULL<br />
<br />
C &gt; ALL(5,NULL)<br />
NULL<br />
<br />
C &gt; ALL(15,NULL)<br />
FALSE<br />
(NOT)BETWEEN<br />
A BETWEEN 5 AND NULL<br />
NULL<br />
<br />
C BETWEEN 5 AND NULL<br />
NULL<br />
<br />
C BETWEEN 15 AND NULL<br />
FALSE<br />
<br />
A NOT BETWEEN 5 AND NULL<br />
NULL<br />
<br />
C NOT BETWEEN 5 AND NULL<br />
NULL<br />
<br />
C NOT BETWEEN 15 AND NULL<br />
TRUE<br />
</span></pre>
<p><span style="color: #000000">---- 3、 空 值 和 算 术、 字 符 操 作 符 </span></p>
<p><span style="color: #000000">---- （1） 算 术 操 作 符： 空 值 不 等 价 于0， 任 何 含 有 空 值 的 算 术 表 达 式 其 运 算 结 果 都 为 空 值， 例 如 空 值 加10 为 空 值。 </span></p>
<p><span style="color: #000000">---- （2） 字 符 操 作 符||： 因 为ORACLE 目 前 处 理 零个 字 符 值 的 方 法 与 处 理 空 值 的 方 法 相 同（ 日 后 的 版 本 中 不 一 定 仍 然 如 此）， 所 以 对于||， 空 值 等 价 于 零 个 字 符 值。 例： </span></p>
<pre><span style="color: #000000">SQL &gt;select ename,mgr,ename||mgr,sal,comm,sal+comm from emp;<br />
ENAME            MGR ENAME||MGR          SAL      COMM  SAL+COMM<br />
---------- --------- ------------- --------- --------- ---------<br />
SMITH           7902 SMITH7902           800 <br />
ALLEN           7698 ALLEN7698          1600       300      1900<br />
WARD            7698 WARD7698           1250       500      1750<br />
JONES           7839 JONES7839          2975 <br />
MARTIN          7698 MARTIN7698         1250      1400      2650<br />
BLAKE           7839 BLAKE7839          2850 <br />
CLARK           7839 CLARK7839          2450 <br />
SCOTT           7566 SCOTT7566          3000 <br />
KING                 KING               5000 <br />
TURNER          7698 TURNER7698         1500         0      1500<br />
ADAMS           7788 ADAMS7788          1100 <br />
JAMES           7698 JAMES7698           950 <br />
FORD            7566 FORD7566           3000 <br />
MILLER          7782 MILLER7782         1300 <br />
</span></pre>
<p><span style="color: #000000">---- 我 们 可 以 看 到， 凡mgr 为 空 值 的，ename||mgr 结 果 等 于ename； 凡 是comm 为 空 值 的 行，sal+comm 均 为 空 值。 </span></p>
<p><span style="color: #000000">---- 四、 空 值 和 函 数 </span></p>
<p><span style="color: #000000">---- 1 ． 空 值 和 度 量 函 数 </span></p>
<p><span style="color: #000000">---- 对 于 度 量 函 数， 如 果 给 定 的 参 数 为 空 值， 则 其（NVL、TRANSLATE 除 外） 返 回 值 为 空 值。 如 下 例 中 的ABS（COMM）， 如 果COMM 为 空 值，ABS(COMM) 为 空 值。 </span></p>
<pre><span style="color: #000000">SQL &gt; select ename,sal,comm,abs(comm) from emp where sal&lt; 1500;<br />
ENAME            SAL      COMM ABS(COMM)<br />
---------- --------- --------- ---------<br />
SMITH            800<br />
WARD            1250       500       500<br />
MARTIN          1250      1400      1400<br />
ADAMS           1100<br />
JAMES            950<br />
MILLER          1300<br />
</span></pre>
<p><span style="color: #000000">---- 2. 空 值 和 组 函 数 </span></p>
<p><span style="color: #000000">---- 组 函 数 忽 略 空 值。 在 实 际 应 用 中， 根 据 需 要 可 利 用nvl 函 数 用 零 代 替 空 值。 例： </span></p>
<pre><span style="color: #000000">SQL &gt;select count(comm),sum(comm),avg(comm) from emp;<br />
COUNT(COMM) SUM(COMM) AVG(COMM)<br />
----------- --------- ---------<br />
4      2200       550<br />
SQL &gt;select count(nvl(comm,0)),sum(nvl(comm,0)),avg(nvl(comm,0))<br />
from emp;<br />
COUNT(NVL(COMM,0)) SUM(NVL(COMM,0)) AVG(NVL(COMM,0))<br />
------------------ ---------------- ----------------<br />
14             2200        157.14286<br />
</span></pre>
<p><span style="color: #000000">---- 第 一 个SELECT 语 句 忽 略COMM 为 空 值 的 行， 第 二个SELECT 语 句 使 用NVL 函 数 统 计 了 所 有 的COMM， 所 以 它 们 统 计 的 个 数、 平 均 值 都 不 相同。 另 外 需 要 注 意 的 是， 在 利 用 组 函 数 进 行 数 据 处 理 时， 不 同 的 写 法 具 有 不 同 的 不 同含 义， 在 实 际 应 用 中 应 灵 活 掌 握。 例 如： </span></p>
<pre><span style="color: #000000">SQL &gt;select deptno,sum(sal),sum(comm), <br />
sum(sal+comm),sum(sal)+sum(comm),sum(nvl(sal,0)+nvl(comm,0)) <br />
from emp<br />
group by deptno;<br />
DEPTNO  SUM(SAL) SUM(COMM) SUM(SAL+COMM) SUM(SAL)<br />
+SUM(COMM) SUM(NVL(SAL,0)+NVL(COMM,0))<br />
--------- --------- --------- ------------- ------- <br />
10   8750                             8750<br />
20   10875                            10875<br />
30   9400      2200       7800        11600 11600<br />
</span></pre>
<p><span style="color: #000000">---- 可 以 看 到SUM(SAL+COMM)、SUM(SAL)+SUM(COMM)、 SUM(NVL(SAL,0)+NVL(COMM,0)) 的 区 别：SUM(SAL+COMM) 为 先 加 然 后 计 算 各 行 的 和，如 果SAL、COMM 中 有 一 个 为NULL， 则 该 行 忽 略 不 计；SUM(SAL)+SUM(COMM) 为 先 计 算 各 行的 合 计 然 后 再 加，SAL、COMM 中 的NULL 都 忽 略 不 计， 但 如 果 SUM(SAL)、SUM(COMM) 二 者的 结 果 之 中 有 一 个 为NULL， 则 二 者 之 和 为NULL； 在SUM(NVL(SAL,0)+NVL(COMM,0)) 里，SAL、COMM 中 的NULL 按0 处 理。 </span></p>
<p><span style="color: #000000">---- 五、 空 值 的 其 它 特 性 </span></p>
<p><span style="color: #000000">---- 1. 空 值 在 排 序 时 大 于 任 何 值。 例 如： </span></p>
<pre><span style="color: #000000">SQL &gt; select ename,comm from emp where deptno='30' order by comm；<br />
ENAME           COMM<br />
---------- ---------<br />
TURNER             0<br />
ALLEN            300<br />
WARD             500<br />
MARTIN          1400<br />
BLAKE <br />
JAMES<br />
</span></pre>
<p><span style="color: #000000">---- 2. 空 值 不 能 被 索 引。 虽 然 在 某 列 上 建 立 了 索 引，但 是 对 该 列 的 空 值 查 询 来 说， 因 为 空 值 没 有 被 索 引， 所 以 不 能 改 善 查 询 的 效 率。 例 如下 面 的 查 询 不 能 利 用 在MGR 列 上 创 建 的 索 引。 </span></p>
<pre><span style="color: #000000">SQL &gt;select ename from emp where mgr is null;<br />
ENAME<br />
----------<br />
KING<br />
</span></pre>
<p><span style="color: #000000">---- 另 外 正 是 因 为 空 值 不 被 索 引， 所 以 可 在 含 有 空 值 的 列 上 建 立 唯 一 性 索 引（UNIQUE INDEX）。 例 如， 可 以 在EMP 表 的COMM 列 上 建 立 唯 一 性 索 引： </span></p>
<pre><span style="color: #000000">SQL &gt;  create unique index emp_comm on emp(comm);<br />
Index created.</span></pre>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/151981.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-10-11 11:14 <a href="http://www.blogjava.net/hllwuxin/archive/2007/10/11/151981.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> MD5算法的java版本（转）</title><link>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146571.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Wed, 19 Sep 2007 10:56:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146571.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/146571.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146571.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/146571.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/146571.html</trackback:ping><description><![CDATA[<div>
<div>package DPS.AuthCom.Radius;</div>
<div><br />
/*************************************************<br />
md5 类实现了RSA Data Security, Inc.在提交给IETF<br />
的RFC1321中的MD5 message-digest 算法。<br />
*************************************************/</div>
<div>public class MD55<br />
{<br />
&nbsp; /* 下面这些S11-S44实际上是一个4*4的矩阵，在原始的C实现中是用#define 实现的，<br />
&nbsp;&nbsp;&nbsp; 这里把它们实现成为static final是表示了只读，切能在同一个进程空间内的多个<br />
&nbsp;&nbsp;&nbsp; Instance间共享*/<br />
&nbsp; static final int S11 = 7;<br />
&nbsp; static final int S12 = 12;<br />
&nbsp; static final int S13 = 17;<br />
&nbsp; static final int S14 = 22;</div>
<div>&nbsp; static final int S21 = 5;<br />
&nbsp; static final int S22 = 9;<br />
&nbsp; static final int S23 = 14;<br />
&nbsp; static final int S24 = 20;</div>
<div>&nbsp; static final int S31 = 4;<br />
&nbsp; static final int S32 = 11;<br />
&nbsp; static final int S33 = 16;<br />
&nbsp; static final int S34 = 23;</div>
<div>&nbsp; static final int S41 = 6;<br />
&nbsp; static final int S42 = 10;<br />
&nbsp; static final int S43 = 15;<br />
&nbsp; static final int S44 = 21;</div>
<div>&nbsp; static final byte[] PADDING =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -128, 0, 0, 0, 0, 0, 0, 0, 0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};<br />
&nbsp; /* 下面的三个成员是MD5计算过程中用到的3个核心数据，在原始的C实现中<br />
&nbsp;&nbsp;&nbsp;&nbsp; 被定义到MD5_CTX结构中</div>
<div>&nbsp;&nbsp; */<br />
&nbsp; private long[] state = new long[4]; // state (ABCD)<br />
&nbsp; private long[] count = new long[2]; // number of bits, modulo 2^64 (lsb first)<br />
&nbsp; private byte[] buffer = new byte[64]; // input buffer</div>
<div>&nbsp; /* digestHexStr是MD5的唯一一个公共成员，是最新一次计算结果的<br />
&nbsp;&nbsp;&nbsp; 　 16进制ASCII表示.<br />
&nbsp;&nbsp; */<br />
&nbsp; public String digestHexStr;</div>
<div>&nbsp; /* digest,是最新一次计算结果的2进制内部表示，表示128bit的MD5值.<br />
&nbsp;&nbsp; */<br />
&nbsp; private byte[] digest = new byte[16];</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp;&nbsp; getMD5ofStr是类MD5最主要的公共方法，入口参数是你想要进行MD5变换的字符串<br />
&nbsp;&nbsp;&nbsp; 返回的是变换完的结果，这个结果是从公共成员digestHexStr取得的．<br />
&nbsp;&nbsp; */<br />
&nbsp; public String getMD5ofStr(String inbuf)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; md5Init();<br />
&nbsp;&nbsp;&nbsp; md5Update(inbuf.getBytes(), inbuf.length());<br />
&nbsp;&nbsp;&nbsp; md5Final();<br />
&nbsp;&nbsp;&nbsp; digestHexStr = "";<br />
&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 16; i++)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digestHexStr += byteHEX(digest[i]);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; return digestHexStr;<br />
&nbsp; }</div>
<div>&nbsp; // 这是MD5这个类的标准构造函数，JavaBean要求有一个public的并且没有参数的构造函数<br />
&nbsp; public MD55()<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; md5Init();</div>
<div>&nbsp;&nbsp;&nbsp; return;<br />
&nbsp; }</div>
<div>&nbsp; /* md5Init是一个初始化函数，初始化核心变量，装入标准的幻数 */<br />
&nbsp; private void md5Init()<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; count[0] = 0L;<br />
&nbsp;&nbsp;&nbsp; count[1] = 0L;<br />
&nbsp;&nbsp;&nbsp; ///* Load magic initialization constants.</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; state[0] = 0x67452301L;<br />
&nbsp;&nbsp;&nbsp; state[1] = 0xefcdab89L;<br />
&nbsp;&nbsp;&nbsp; state[2] = 0x98badcfeL;<br />
&nbsp;&nbsp;&nbsp; state[3] = 0x10325476L;</div>
<div>&nbsp;&nbsp;&nbsp; return;<br />
&nbsp; }</div>
<div>&nbsp; /* F, G, H ,I 是4个基本的MD5函数，在原始的MD5的C实现中，由于它们是<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 简单的位运算，可能出于效率的考虑把它们实现成了宏，在java中，我们把它们<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 　　实现成了private方法，名字保持了原来C中的。 */</div>
<div>&nbsp; private long F(long x, long y, long z)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; return (x &amp; y) | ( (~x) &amp; z);</div>
<div>&nbsp; }</div>
<div>&nbsp; private long G(long x, long y, long z)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; return (x &amp; z) | (y &amp; (~z));</div>
<div>&nbsp; }</div>
<div>&nbsp; private long H(long x, long y, long z)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; return x ^ y ^ z;<br />
&nbsp; }</div>
<div>&nbsp; private long I(long x, long y, long z)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; return y ^ (x | (~z));<br />
&nbsp; }</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp;&nbsp;&nbsp; FF,GG,HH和II将调用F,G,H,I进行近一步变换<br />
&nbsp;&nbsp;&nbsp;&nbsp; FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.<br />
&nbsp;&nbsp;&nbsp;&nbsp; Rotation is separate from addition to prevent recomputation.<br />
&nbsp;&nbsp; */</div>
<div>&nbsp; private long FF(long a, long b, long c, long d, long x, long s,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long ac)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; a += F(b, c, d) + x + ac;<br />
&nbsp;&nbsp;&nbsp; a = ( (int) a &lt;&lt; s) | ( (int) a &gt;&gt;&gt; (32 - s));<br />
&nbsp;&nbsp;&nbsp; a += b;<br />
&nbsp;&nbsp;&nbsp; return a;<br />
&nbsp; }</div>
<div>&nbsp; private long GG(long a, long b, long c, long d, long x, long s,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long ac)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; a += G(b, c, d) + x + ac;<br />
&nbsp;&nbsp;&nbsp; a = ( (int) a &lt;&lt; s) | ( (int) a &gt;&gt;&gt; (32 - s));<br />
&nbsp;&nbsp;&nbsp; a += b;<br />
&nbsp;&nbsp;&nbsp; return a;<br />
&nbsp; }</div>
<div>&nbsp; private long HH(long a, long b, long c, long d, long x, long s,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long ac)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; a += H(b, c, d) + x + ac;<br />
&nbsp;&nbsp;&nbsp; a = ( (int) a &lt;&lt; s) | ( (int) a &gt;&gt;&gt; (32 - s));<br />
&nbsp;&nbsp;&nbsp; a += b;<br />
&nbsp;&nbsp;&nbsp; return a;<br />
&nbsp; }</div>
<div>&nbsp; private long II(long a, long b, long c, long d, long x, long s,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long ac)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; a += I(b, c, d) + x + ac;<br />
&nbsp;&nbsp;&nbsp; a = ( (int) a &lt;&lt; s) | ( (int) a &gt;&gt;&gt; (32 - s));<br />
&nbsp;&nbsp;&nbsp; a += b;<br />
&nbsp;&nbsp;&nbsp; return a;<br />
&nbsp; }</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp; md5Update是MD5的主计算过程，inbuf是要变换的字节串，inputlen是长度，这个<br />
&nbsp;&nbsp; 函数由getMD5ofStr调用，调用之前需要调用md5init，因此把它设计成private的<br />
&nbsp;&nbsp; */<br />
&nbsp; private void md5Update(byte[] inbuf, int inputLen)<br />
&nbsp; {</div>
<div>&nbsp;&nbsp;&nbsp; int i, index, partLen;<br />
&nbsp;&nbsp;&nbsp; byte[] block = new byte[64];<br />
&nbsp;&nbsp;&nbsp; index = (int) (count[0] &gt;&gt;&gt; 3) &amp; 0x3F;<br />
&nbsp;&nbsp;&nbsp; // /* Update number of bits */<br />
&nbsp;&nbsp;&nbsp; if ( (count[0] += (inputLen &lt;&lt; 3)) &lt; (inputLen &lt;&lt; 3))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count[1]++;<br />
&nbsp;&nbsp;&nbsp; count[1] += (inputLen &gt;&gt;&gt; 29);</div>
<div>&nbsp;&nbsp;&nbsp; partLen = 64 - index;</div>
<div>&nbsp;&nbsp;&nbsp; // Transform as many times as possible.<br />
&nbsp;&nbsp;&nbsp; if (inputLen &gt;= partLen)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5Memcpy(buffer, inbuf, index, 0, partLen);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5Transform(buffer);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i = partLen; i + 63 &lt; inputLen; i += 64)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5Memcpy(block, inbuf, 0, i, 64);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5Transform(block);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index = 0;</div>
<div>&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; else</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = 0;</div>
<div>&nbsp;&nbsp;&nbsp; ///* Buffer remaining input */<br />
&nbsp;&nbsp;&nbsp; md5Memcpy(buffer, inbuf, index, i, inputLen - i);</div>
<div>&nbsp; }</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp;&nbsp; md5Final整理和填写输出结果<br />
&nbsp;&nbsp; */<br />
&nbsp; private void md5Final()<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; byte[] bits = new byte[8];<br />
&nbsp;&nbsp;&nbsp; int index, padLen;</div>
<div>&nbsp;&nbsp;&nbsp; ///* Save number of bits */<br />
&nbsp;&nbsp;&nbsp; Encode(bits, count, 8);</div>
<div>&nbsp;&nbsp;&nbsp; ///* Pad out to 56 mod 64.<br />
&nbsp;&nbsp;&nbsp;&nbsp; index = (int) (count[0] &gt;&gt;&gt; 3) &amp; 0x3f;<br />
&nbsp;&nbsp;&nbsp; padLen = (index &lt;<br />
&nbsp;&nbsp;&nbsp; md5Update(PADDING, padLen);</div>
<div>&nbsp;&nbsp;&nbsp; ///* Append length (before padding) */<br />
&nbsp;&nbsp;&nbsp; md5Update(bits, 8);</div>
<div>&nbsp;&nbsp;&nbsp; ///* Store state in digest */<br />
&nbsp;&nbsp;&nbsp; Encode(digest, state, 16);</div>
<div>&nbsp; }</div>
<div>&nbsp; /* md5Memcpy是一个内部使用的byte数组的块拷贝函数，从input的inpos开始把len长度的<br />
&nbsp;&nbsp; 　　　　　 字节拷贝到output的outpos位置开始<br />
&nbsp;&nbsp; */</div>
<div>&nbsp; private void md5Memcpy(byte[] output, byte[] input,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int outpos, int inpos, int len)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; int i;</div>
<div>&nbsp;&nbsp;&nbsp; for (i = 0; i &lt; len; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[outpos + i] = input[inpos + i];<br />
&nbsp; }</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp;&nbsp;&nbsp; md5Transform是MD5核心变换程序，有md5Update调用，block是分块的原始字节<br />
&nbsp;&nbsp; */<br />
&nbsp; private void md5Transform(byte block[])<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; long a = state[0], b = state[1], c = state[2], d = state[3];<br />
&nbsp;&nbsp;&nbsp; long[] x = new long[16];</div>
<div>&nbsp;&nbsp;&nbsp; Decode(x, block, 64);</div>
<div>&nbsp;&nbsp;&nbsp; /* Round 1 */<br />
&nbsp;&nbsp;&nbsp; a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */<br />
&nbsp;&nbsp;&nbsp; d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */<br />
&nbsp;&nbsp;&nbsp; c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */<br />
&nbsp;&nbsp;&nbsp; b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */<br />
&nbsp;&nbsp;&nbsp; a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */<br />
&nbsp;&nbsp;&nbsp; d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */<br />
&nbsp;&nbsp;&nbsp; c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */<br />
&nbsp;&nbsp;&nbsp; b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */<br />
&nbsp;&nbsp;&nbsp; a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */<br />
&nbsp;&nbsp;&nbsp; d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */<br />
&nbsp;&nbsp;&nbsp; c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */<br />
&nbsp;&nbsp;&nbsp; b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */<br />
&nbsp;&nbsp;&nbsp; a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */<br />
&nbsp;&nbsp;&nbsp; d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */<br />
&nbsp;&nbsp;&nbsp; c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */<br />
&nbsp;&nbsp;&nbsp; b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */</div>
<div>&nbsp;&nbsp;&nbsp; /* Round 2 */<br />
&nbsp;&nbsp;&nbsp; a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */<br />
&nbsp;&nbsp;&nbsp; d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */<br />
&nbsp;&nbsp;&nbsp; c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */<br />
&nbsp;&nbsp;&nbsp; b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */<br />
&nbsp;&nbsp;&nbsp; a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */<br />
&nbsp;&nbsp;&nbsp; d = GG(d, a, b, c, x[10], S22, 0x2441453L); /* 22 */<br />
&nbsp;&nbsp;&nbsp; c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */<br />
&nbsp;&nbsp;&nbsp; b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */<br />
&nbsp;&nbsp;&nbsp; a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */<br />
&nbsp;&nbsp;&nbsp; d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */<br />
&nbsp;&nbsp;&nbsp; c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */<br />
&nbsp;&nbsp;&nbsp; b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */<br />
&nbsp;&nbsp;&nbsp; a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */<br />
&nbsp;&nbsp;&nbsp; d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */<br />
&nbsp;&nbsp;&nbsp; c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */<br />
&nbsp;&nbsp;&nbsp; b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */</div>
<div>&nbsp;&nbsp;&nbsp; /* Round 3 */<br />
&nbsp;&nbsp;&nbsp; a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */<br />
&nbsp;&nbsp;&nbsp; d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */<br />
&nbsp;&nbsp;&nbsp; c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */<br />
&nbsp;&nbsp;&nbsp; b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */<br />
&nbsp;&nbsp;&nbsp; a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */<br />
&nbsp;&nbsp;&nbsp; d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */<br />
&nbsp;&nbsp;&nbsp; c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */<br />
&nbsp;&nbsp;&nbsp; b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */<br />
&nbsp;&nbsp;&nbsp; a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */<br />
&nbsp;&nbsp;&nbsp; d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */<br />
&nbsp;&nbsp;&nbsp; c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */<br />
&nbsp;&nbsp;&nbsp; b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */<br />
&nbsp;&nbsp;&nbsp; a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */<br />
&nbsp;&nbsp;&nbsp; d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */<br />
&nbsp;&nbsp;&nbsp; c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */<br />
&nbsp;&nbsp;&nbsp; b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */</div>
<div>&nbsp;&nbsp;&nbsp; /* Round 4 */<br />
&nbsp;&nbsp;&nbsp; a = II(a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */<br />
&nbsp;&nbsp;&nbsp; d = II(d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */<br />
&nbsp;&nbsp;&nbsp; c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */<br />
&nbsp;&nbsp;&nbsp; b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */<br />
&nbsp;&nbsp;&nbsp; a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */<br />
&nbsp;&nbsp;&nbsp; d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */<br />
&nbsp;&nbsp;&nbsp; c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */<br />
&nbsp;&nbsp;&nbsp; b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */<br />
&nbsp;&nbsp;&nbsp; a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */<br />
&nbsp;&nbsp;&nbsp; d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */<br />
&nbsp;&nbsp;&nbsp; c = II(c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */<br />
&nbsp;&nbsp;&nbsp; b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */<br />
&nbsp;&nbsp;&nbsp; a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */<br />
&nbsp;&nbsp;&nbsp; d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */<br />
&nbsp;&nbsp;&nbsp; c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */<br />
&nbsp;&nbsp;&nbsp; b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */</div>
<div>&nbsp;&nbsp;&nbsp; state[0] += a;<br />
&nbsp;&nbsp;&nbsp; state[1] += b;<br />
&nbsp;&nbsp;&nbsp; state[2] += c;<br />
&nbsp;&nbsp;&nbsp; state[3] += d;</div>
<div>&nbsp; }</div>
<div>&nbsp; /*Encode把long数组按顺序拆成byte数组，因为java的long类型是64bit的，<br />
&nbsp;&nbsp;&nbsp; 只拆低32bit，以适应原始C实现的用途<br />
&nbsp;&nbsp; */<br />
&nbsp; private void Encode(byte[] output, long[] input, int len)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; int i, j;</div>
<div>&nbsp;&nbsp;&nbsp; for (i = 0, j = 0; j &lt; len; i++, j += 4)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[j] = (byte) (input[i] &amp; 0xffL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[j + 1] = (byte) ( (input[i] &gt;&gt;&gt; 8) &amp; 0xffL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[j + 2] = (byte) ( (input[i] &gt;&gt;&gt; 16) &amp; 0xffL);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[j + 3] = (byte) ( (input[i] &gt;&gt;&gt; 24) &amp; 0xffL);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp; }</div>
<div>&nbsp; /*Decode把byte数组按顺序合成成long数组，因为java的long类型是64bit的，<br />
&nbsp;&nbsp;&nbsp; 只合成低32bit，高32bit清零，以适应原始C实现的用途<br />
&nbsp;&nbsp; */<br />
&nbsp; private void Decode(long[] output, byte[] input, int len)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; int i, j;</div>
<div>&nbsp;&nbsp;&nbsp; for (i = 0, j = 0; j &lt; len; i++, j += 4)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output[i] = b2iu(input[j]) |<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (b2iu(input[j + 1]) &lt;&lt; 8) |<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (b2iu(input[j + 2]) &lt;&lt; 16) |<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (b2iu(input[j + 3]) &lt;&lt; 24);</div>
<div>&nbsp;&nbsp;&nbsp; return;<br />
&nbsp; }</div>
<div>&nbsp; /*<br />
&nbsp;&nbsp;&nbsp; b2iu是我写的一个把byte按照不考虑正负号的原则的＂升位＂程序，因为java没有unsigned运算<br />
&nbsp;&nbsp; */<br />
&nbsp; public static long b2iu(byte b)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; return b &lt; 0 ? b &amp;<br />
&nbsp; }</div>
<div>&nbsp; /*byteHEX()，用来把一个byte类型的数转换成十六进制的ASCII表示，<br />
&nbsp;&nbsp;&nbsp; 　因为java中的byte的toString无法实现这一点，我们又没有C语言中的<br />
&nbsp;&nbsp;&nbsp; sprintf(outbuf,"%02X",ib)<br />
&nbsp;&nbsp; */<br />
&nbsp; public static String byteHEX(byte ib)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; char[] Digit =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'A', 'B', 'C', 'D', 'E', 'F'};<br />
&nbsp;&nbsp;&nbsp; char[] ob = new char[2];<br />
&nbsp;&nbsp;&nbsp; ob[0] = Digit[ (ib &gt;&gt;&gt; 4) &amp; 0X0F];<br />
&nbsp;&nbsp;&nbsp; ob[1] = Digit[ib &amp; 0X0F];<br />
&nbsp;&nbsp;&nbsp; String s = new String(ob);<br />
&nbsp;&nbsp;&nbsp; return s;<br />
&nbsp; }</div>
<div>&nbsp; /**<br />
&nbsp;&nbsp; * getMD5ofBye<br />
&nbsp;&nbsp; *<br />
&nbsp;&nbsp; * @param inbuf byte[]<br />
&nbsp;&nbsp; * @return byte[]<br />
&nbsp;&nbsp; */<br />
&nbsp; public byte[] getMD5ofBye(byte[] inbuf)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; md5Init();<br />
&nbsp;&nbsp;&nbsp; md5Update(inbuf, inbuf.length);<br />
&nbsp;&nbsp;&nbsp; md5Final();<br />
&nbsp;&nbsp;&nbsp; digestHexStr = "";&nbsp;&nbsp;&nbsp; </div>
<div>&nbsp;&nbsp; for (int i = 0; i &lt; 16; i++)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digestHexStr += byteHEX(digest[i]);&nbsp;&nbsp;&nbsp; </div>
<div>&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; return digestHexStr.getBytes();</div>
<div>&nbsp; }<br />
}</div>
<div>&nbsp;</div>
<div>注：如果有人使用过这个版本的MD5算法，会发现和c的返回值不一样，是因为c返回的是一个char*的指针，而java并没有指针，和c程序在内存中的值明显对不上，即使把最后一个方法getMD5ofBye的返回值改成char[]还是达不到目的，而且你会看到c内存中返回值的一个字节是java内存中返回值的两个字节合在一起的值，举个例子：比如说c中的返回值是char a[0] ='0x12',而java中返回值则是char b[0] = '0x01',b[1] = '0x02'。要怎么改变这种在内存中返回值不同的情况？你可以把byteHEX方法完全注释掉，换成下面这个方法：</div>
<div>public static byte byteHEX(byte ib)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ib;<br />
&nbsp; }</div>
<div>并且把getMD5ofBye方法稍作修改，即改成：<br />
public byte[] getMD5ofBye(byte[] inbuf)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp; md5Init();<br />
&nbsp;&nbsp;&nbsp; md5Update(inbuf, inbuf.length);<br />
&nbsp;&nbsp;&nbsp; md5Final();<br />
&nbsp;&nbsp;&nbsp; byte digestHexStr;</div>
<div>&nbsp;&nbsp;&nbsp; byte b[] = new byte[16];//大小根据需要自己定；<br />
&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 16; i++)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digestHexStr += byteHEX(digest[i]);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b[i] = digestHexStr&nbsp;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; return b;</div>
<div>&nbsp; }<br />
</div>
<div>
<div>经过这样的处理后，java版本的MD5算法就和c版本的MD5算法在返回值上完全一致了。</div>
</div>
</div>
 <img src ="http://www.blogjava.net/hllwuxin/aggbug/146571.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-09-19 18:56 <a href="http://www.blogjava.net/hllwuxin/archive/2007/09/19/146571.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> LookupDispatchAction使用示例</title><link>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146445.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Wed, 19 Sep 2007 05:31:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146445.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/146445.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146445.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/146445.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/146445.html</trackback:ping><description><![CDATA[<div class="g_t_left c07 content" id="blogtext__fks_C7G4Ko7-pHAFD6ZGnFlv9OGMEn5dYI0i">
<p>LookupDispatchAction是DispatchAction的子类。他的作用是将多个响应用户请求的Action方法放置在同一个Action中。</p>
<p>LookupDispatchAction主要适合用于页面中同一个表单具有多个提交按钮，每个提交按钮要递交给不同的Action处理方法的情况。</p>
<p>LookupDispatchAction所执行的方法也是依据页面传递的参数来确定的。而具体执行哪个Action方法则是由用户提交参数的值、资源文件、定义的映射方法所共同决定的。</p>
<p><strong><font style="background-color: #ffffff" color="#ff0000" size="4">具体请参考下面的例题：</font></strong></p>
<p><font color="#0000ff"><strong>1、先在JSP页面中使用如下的提交按钮：</strong></font></p>
<p><strong><font color="#0000ff">#test.jsp</font></strong></p>
<p>&nbsp; &lt;html:form action="/test"&gt;<br />
&nbsp;&nbsp; &nbsp;&nbsp; &lt;!--property属性的值一定与ActionMapping中的parameter属性的值相同--&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&lt;html:submit property="method"&gt;&lt;bean:message key="button.add"/&gt;&lt;/html:submit&gt; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&lt;html:submit property="method"&gt;&lt;bean:message key="button.delete"/&gt;&lt;/html:submit&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/html:form&gt;</p>
<p><strong><font color="#0000ff">2、在Struts的配置文件中设置paramerter属性：</font></strong></p>
<p><strong><font color="#0000ff">#struts-config.xml</font></strong></p>
<p>&lt;!-- parameter属性指页面中按钮的名称,其中的name属性中的ActionForm随便建个就行我的是空的 --&gt;</p>
<p>&lt;action path="/test" type="action.TestLookUpDispatchAction" scope="request" input="test.jsp" parameter="method" &gt;&lt;/action&gt; </p>
<p><font color="#0000ff"><strong>3、创建一个继承LookupDispatchAction的类，名叫TestLookUpDispatchAction放在action包下：</strong></font></p>
<p><strong><font color="#0000ff">#TestLookUpDispatchAction.java</font></strong></p>
<p>package action;</p>
<p>import java.util.HashMap;<br />
import java.util.Map;</p>
<p>import javax.servlet.http.HttpServletRequest;<br />
import javax.servlet.http.HttpServletResponse;</p>
<p>import org.apache.struts.action.ActionForm;<br />
import org.apache.struts.action.ActionForward;<br />
import org.apache.struts.action.ActionMapping;<br />
import org.apache.struts.actions.LookupDispatchAction;</p>
<p>public class TestLookUpDispatchAction extends LookupDispatchAction {</p>
<blockquote dir="ltr" style="margin-right: 0px">
<p>&nbsp;@Override<br />
&nbsp;protected Map getKeyMethodMap() {// 定义资源文件关键字与Action方法之间的映射关系<br />
&nbsp;&nbsp;&nbsp;&nbsp; Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp; map.put("button.add", "add");<br />
&nbsp;&nbsp;&nbsp; &nbsp;map.put("button.delete", "delete");<br />
&nbsp;&nbsp;&nbsp; &nbsp;return map;<br />
&nbsp;}</p>
<p>&nbsp;// 自定义的方法<br />
&nbsp;public ActionForward add(ActionMapping mapping, ActionForm form,<br />
&nbsp;&nbsp;&nbsp;HttpServletRequest request, HttpServletResponse response)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;System.out.println("执行add方法成功");<br />
&nbsp;&nbsp;return null;<br />
&nbsp;}</p>
</blockquote>
<p dir="ltr">&nbsp;// 自定义的方法<br />
&nbsp;public ActionForward delete(ActionMapping mapping, ActionForm form,<br />
&nbsp;&nbsp;&nbsp;HttpServletRequest request, HttpServletResponse response)<br />
&nbsp;&nbsp;&nbsp;throws Exception {<br />
&nbsp;&nbsp;System.out.println("执行delete方法成功");<br />
&nbsp;&nbsp;return null;<br />
&nbsp;}<br />
}<br />
<font color="#0000ff"><strong>4、在资源文件中为每个标记定义显示信息：</strong></font></p>
<p dir="ltr"><strong><font color="#0000ff">message.properties</font></strong></p>
<p dir="ltr">button.add=add<br />
button.delete=delete</p>
<p dir="ltr">这样就OK了，你可以试一下是否能调用到自己想要的方法。有什么问题可以联系我。</p>
</div>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/146445.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-09-19 13:31 <a href="http://www.blogjava.net/hllwuxin/archive/2007/09/19/146445.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Hibernate 参数设置一览表</title><link>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146442.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Wed, 19 Sep 2007 05:28:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146442.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/146442.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146442.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/146442.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/146442.html</trackback:ping><description><![CDATA[<div class="g_t_left c07 content" id="blogtext__fks_qnIMoPC_-qFbwaC2GoWdZmvqZoFqeqXx">Hibernate配置属性
<table summary="&amp;10;                Hibernate配置属性&amp;10;            " border="1">
    <colgroup><strong>
    <col>
    <col></strong></colgroup>
    <thead>
        <tr>
            <th>属性名 </th>
            <th>用途 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">hibernate.dialect</font></tt></td>
            <td>一个Hibernate <tt><font face="新宋体">Dialect</font></tt>类名允许Hibernate针对特定的关系数据库生成优化的SQL. <span>取值</span> <tt><font face="新宋体">full.classname.of.Dialect</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.show_sql</font></tt></td>
            <td>输出所有SQL语句到控制台. 有一个另外的选择是把<tt><font face="新宋体">org.hibernate.SQL</font></tt>这个log category设为<tt><font face="新宋体">debug</font></tt>。 <span>eg.</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.format_sql</font></tt></td>
            <td>在log和console中打印出更漂亮的SQL。 <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.default_schema</font></tt></td>
            <td>在生成的SQL中, 将给定的schema/tablespace附加于非全限定名的表名上. <span>取值</span> <tt><font face="新宋体">SCHEMA_NAME</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.default_catalog</font></tt></td>
            <td>在生成的SQL中, 将给定的catalog附加于非全限定名的表名上. <span>取值</span> <tt><font face="新宋体">CATALOG_NAME</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.session_factory_name</font></tt></td>
            <td><tt><font face="新宋体">SessionFactory</font></tt>创建后，将自动使用这个名字绑定到JNDI中. <span>取值</span> <tt><font face="新宋体">jndi/composite/name</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.max_fetch_depth</font></tt></td>
            <td>为单向关联(一对一, 多对一)的外连接抓取（outer join fetch）树设置最大深度. 值为<tt><font face="新宋体">0</font></tt>意味着将关闭默认的外连接抓取. <span>取值</span> 建议在<tt><font face="新宋体">0</font></tt>到<tt><font face="新宋体">3</font></tt>之间取值 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.default_batch_fetch_size</font></tt></td>
            <td>为Hibernate关联的批量抓取设置默认数量. <span>取值</span> 建议的取值为<tt><font face="新宋体">4</font></tt>, <tt><font face="新宋体">8</font></tt>, 和<tt><font face="新宋体">16</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.default_entity_mode</font></tt></td>
            <td>为由这个<tt><font face="新宋体">SessionFactory</font></tt>打开的所有Session指定默认的实体表现模式. <span>取值</span> <tt><font face="新宋体">dynamic-map</font></tt>, <tt><font face="新宋体">dom4j</font></tt>, <tt><font face="新宋体">pojo</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.order_updates</font></tt></td>
            <td>强制Hibernate按照被更新数据的主键，为SQL更新排序。这么做将减少在高并发系统中事务的死锁。 <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.generate_statistics</font></tt></td>
            <td>如果开启, Hibernate将收集有助于性能调节的统计数据. <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.use_identifer_rollback</font></tt></td>
            <td>如果开启, 在对象被删除时生成的标识属性将被重设为默认值. <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.use_sql_comments</font></tt></td>
            <td>如果开启, Hibernate将在SQL中生成有助于调试的注释信息, 默认值为<tt><font face="新宋体">false</font></tt>. <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
    </tbody>
</table>
<div><a></a>
<p><strong>表&nbsp;3.4.&nbsp; Hibernate JDBC和连接(connection)属性 </strong></p>
<table summary="&amp;10;                Hibernate JDBC和连接(connection)属性&amp;10;            " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>属性名 </th>
            <th>用途 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.fetch_size</font></tt></td>
            <td>非零值，指定JDBC抓取数量的大小 (调用<tt><font face="新宋体">Statement.setFetchSize()</font></tt>). </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.batch_size</font></tt></td>
            <td>非零值，允许Hibernate使用JDBC2的批量更新. <span>取值</span> 建议取<tt><font face="新宋体">5</font></tt>到<tt><font face="新宋体">30</font></tt>之间的值 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.batch_versioned_data</font></tt></td>
            <td>如果你想让你的JDBC驱动从<tt><font face="新宋体">executeBatch()</font></tt>返回正确的行计数 , 那么将此属性设为<tt><font face="新宋体">true</font></tt>(开启这个选项通常是安全的). 同时，Hibernate将为自动版本化的数据使用批量DML. 默认值为<tt><font face="新宋体">false</font></tt>. <span>eg.</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.factory_class</font></tt></td>
            <td>选择一个自定义的<tt><font face="新宋体">Batcher</font></tt>. 多数应用程序不需要这个配置属性. <span>eg.</span> <tt><font face="新宋体">classname.of.Batcher</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.use_scrollable_resultset</font></tt></td>
            <td>允许Hibernate使用JDBC2的可滚动结果集. 只有在使用用户提供的JDBC连接时，这个选项才是必要的, 否则Hibernate会使用连接的元数据. <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.use_streams_for_binary</font></tt></td>
            <td>在JDBC读写<tt><font face="新宋体">binary (二进制)</font></tt>或<tt><font face="新宋体">serializable (可序列化)</font></tt> 的类型时使用流(stream)(系统级属性). <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jdbc.use_get_generated_keys</font></tt></td>
            <td>在数据插入数据库之后，允许使用JDBC3 <tt><font face="新宋体">PreparedStatement.getGeneratedKeys()</font></tt> 来获取数据库生成的key(键)。需要JDBC3+驱动和JRE1.4+, 如果你的数据库驱动在使用Hibernate的标 识生成器时遇到问题，请将此值设为false. 默认情况下将使用连接的元数据来判定驱动的能力. <span>取值</span> <tt><font face="新宋体">true|false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.connection.provider_class</font></tt></td>
            <td>自定义<tt><font face="新宋体">ConnectionProvider</font></tt>的类名, 此类用来向Hibernate提供JDBC连接. <span>取值</span> <tt><font face="新宋体">classname.of.ConnectionProvider</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.connection.isolation</font></tt></td>
            <td>设置JDBC事务隔离级别. 查看<tt><font face="新宋体">java.sql.Connection</font></tt>来了解各个值的具体意义, 但请注意多数数据库都不支持所有的隔离级别. <span>取值</span> <tt><font face="新宋体">1, 2, 4, 8</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.connection.autocommit</font></tt></td>
            <td>允许被缓存的JDBC连接开启自动提交(autocommit) (不建议). <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.connection.release_mode</font></tt></td>
            <td>指定Hibernate在何时释放JDBC连接. 默认情况下,直到Session被显式关闭或被断开连接时,才会释放JDBC连接. 对于应用程序服务器的JTA数据源, 你应当使用<tt><font face="新宋体">after_statement</font></tt>, 这样在每次JDBC调用后，都会主动的释放连接. 对于非JTA的连接, 使用<tt><font face="新宋体">after_transaction</font></tt>在每个事务结束时释放连接是合理的. <tt><font face="新宋体">auto</font></tt>将为JTA和CMT事务策略选择<tt><font face="新宋体">after_statement</font></tt>, 为JDBC事务策略选择<tt><font face="新宋体">after_transaction</font></tt>. <span>取值</span> <tt><font face="新宋体">on_close</font></tt> | <tt><font face="新宋体">after_transaction</font></tt> | <tt><font face="新宋体">after_statement</font></tt> | <tt><font face="新宋体">auto</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.connection.<span><em>&lt;propertyName&gt;</em></span></font></tt></td>
            <td>将JDBC属性<tt><font face="新宋体">propertyName</font></tt>传递到<tt><font face="新宋体">DriverManager.getConnection()</font></tt>中去. </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.jndi.<span><em>&lt;propertyName&gt;</em></span></font></tt></td>
            <td>将属性<tt><font face="新宋体">propertyName</font></tt>传递到JNDI <tt><font face="新宋体">InitialContextFactory</font></tt>中去. </td>
        </tr>
    </tbody>
</table>
</div>
<div><a></a>
<p><strong>表&nbsp;3.5.&nbsp; Hibernate缓存属性 </strong></p>
<table summary="&amp;10;                Hibernate缓存属性&amp;10;            " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>属性名 </th>
            <th>用途 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.provider_class</font></tt></td>
            <td>自定义的<tt><font face="新宋体">CacheProvider</font></tt>的类名. <span>取值</span> <tt><font face="新宋体">classname.of.CacheProvider</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.use_minimal_puts</font></tt></td>
            <td>以频繁的读操作为代价, 优化二级缓存来最小化写操作. 在Hibernate3中，这个设置对的集群缓存非常有用, 对集群缓存的实现而言，默认是开启的. <span>取值</span> <tt><font face="新宋体">true|false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.use_query_cache</font></tt></td>
            <td>允许查询缓存, 个别查询仍然需要被设置为可缓存的. <span>取值</span> <tt><font face="新宋体">true|false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.use_second_level_cache</font></tt></td>
            <td>能用来完全禁止使用二级缓存. 对那些在类的映射定义中指定<tt><font face="新宋体">&lt;cache&gt;</font></tt>的类，会默认开启二级缓存. <span>取值</span> <tt><font face="新宋体">true|false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.query_cache_factory</font></tt></td>
            <td>自定义实现<tt><font face="新宋体">QueryCache</font></tt>接口的类名, 默认为内建的<tt><font face="新宋体">StandardQueryCache</font></tt>. <span>取值</span> <tt><font face="新宋体">classname.of.QueryCache</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.region_prefix</font></tt></td>
            <td>二级缓存区域名的前缀. <span>取值</span> <tt><font face="新宋体">prefix</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cache.use_structured_entries</font></tt></td>
            <td>强制Hibernate以更人性化的格式将数据存入二级缓存. <span>取值</span> <tt><font face="新宋体">true|false</font></tt> </td>
        </tr>
    </tbody>
</table>
</div>
<div><a></a>
<p><strong>表&nbsp;3.6.&nbsp; Hibernate事务属性 </strong></p>
<table summary="&amp;10;                Hibernate事务属性&amp;10;            " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>属性名 </th>
            <th>用途 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">hibernate.transaction.factory_class</font></tt></td>
            <td>一个<tt><font face="新宋体">TransactionFactory</font></tt>的类名, 用于Hibernate <tt><font face="新宋体">Transaction</font></tt> API (默认为<tt><font face="新宋体">JDBCTransactionFactory</font></tt>). <span>取值</span> <tt><font face="新宋体">classname.of.TransactionFactory</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">jta.UserTransaction</font></tt></td>
            <td>一个JNDI名字，被<tt><font face="新宋体">JTATransactionFactory</font></tt>用来从应用服务器获取JTA <tt><font face="新宋体">UserTransaction</font></tt>. <span>取值</span> <tt><font face="新宋体">jndi/composite/name</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.transaction.manager_lookup_class</font></tt></td>
            <td>一个<tt><font face="新宋体">TransactionManagerLookup</font></tt>的类名 - 当使用JVM级缓存，或在JTA环境中使用hilo生成器的时候需要该类. <span>取值</span> <tt><font face="新宋体">classname.of.TransactionManagerLookup</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.transaction.flush_before_completion</font></tt></td>
            <td>如果开启, session在事务完成后将被自动清洗(flush)。 现在更好的方法是使用自动session上下文管理。<span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.transaction.auto_close_session</font></tt></td>
            <td>如果开启, session在事务完成后将被自动关闭。 现在更好的方法是使用自动session上下文管理。<span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
    </tbody>
</table>
</div>
<div><a></a>
<p><strong>表&nbsp;3.7.&nbsp; 其他属性 </strong></p>
<table summary="&amp;10;                其他属性&amp;10;            " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>属性名 </th>
            <th>用途 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">hibernate.current_session_context_class</font></tt></td>
            <td>为"当前" <tt><font face="新宋体">Session</font></tt>指定一个(自定义的)策略。<span>eg.</span> <tt><font face="新宋体">jta</font></tt> | <tt><font face="新宋体">thread</font></tt> | <tt><font face="新宋体">custom.Class</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.query.factory_class</font></tt></td>
            <td>选择HQL解析器的实现. <span>取值</span> <tt><font face="新宋体">org.hibernate.hql.ast.ASTQueryTranslatorFactory</font></tt> or <tt><font face="新宋体">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.query.substitutions</font></tt></td>
            <td>将Hibernate查询中的符号映射到SQL查询中的符号 (符号可能是函数名或常量名字). <span>取值</span> <tt><font face="新宋体">hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.hbm2ddl.auto</font></tt></td>
            <td>在<tt><font face="新宋体">SessionFactory</font></tt>创建时，自动检查数据库结构，或者将数据库schema的DDL导出到数据库. 使用 <tt><font face="新宋体">create-drop</font></tt>时,在显式关闭<tt><font face="新宋体">SessionFactory</font></tt>时，将drop掉数据库schema. <span>取值</span> <tt><font face="新宋体">validate</font></tt> | <tt><font face="新宋体">update</font></tt> | <tt><font face="新宋体">create</font></tt> | <tt><font face="新宋体">create-drop</font></tt> </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">hibernate.cglib.use_reflection_optimizer</font></tt></td>
            <td>开启CGLIB来替代运行时反射机制(系统级属性). 反射机制有时在除错时比较有用. 注意即使关闭这个优化, Hibernate还是需要CGLIB. 你不能在<tt><font face="新宋体">hibernate.cfg.xml</font></tt>中设置此属性. <span>取值</span> <tt><font face="新宋体">true</font></tt> | <tt><font face="新宋体">false</font></tt> </td>
        </tr>
    </tbody>
</table>
</div>
<div>
<div>
<div>
<div>
<h3><a></a>3.4.1.&nbsp; SQL方言 </h3>
</div>
</div>
<div></div>
</div>
<p>你应当总是为你的数据库将<tt><font face="新宋体">hibernate.dialect</font></tt>属性设置成正确的 <tt><font face="新宋体">org.hibernate.dialect.Dialect</font></tt>子类. 如果你指定一种方言, Hibernate将为上面列出的一些属性使用合理的默认值, 为你省去了手工指定它们的功夫. </p>
<div><a></a>
<p><strong>表&nbsp;3.8.&nbsp; Hibernate SQL方言 (<tt><font face="新宋体">hibernate.dialect</font></tt>) </strong></p>
<table summary="&amp;10;                    Hibernate SQL方言 (hibernate.dialect)&amp;10;                " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>RDBMS</th>
            <th>方言 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>DB2</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.DB2Dialect</font></tt></td>
        </tr>
        <tr>
            <td>DB2 AS/400</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.DB2400Dialect</font></tt></td>
        </tr>
        <tr>
            <td>DB2 OS390</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.DB2390Dialect</font></tt></td>
        </tr>
        <tr>
            <td>PostgreSQL</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.PostgreSQLDialect</font></tt></td>
        </tr>
        <tr>
            <td>MySQL</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.MySQLDialect</font></tt></td>
        </tr>
        <tr>
            <td>MySQL with InnoDB</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.MySQLInnoDBDialect</font></tt></td>
        </tr>
        <tr>
            <td>MySQL with MyISAM</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.MySQLMyISAMDialect</font></tt></td>
        </tr>
        <tr>
            <td>Oracle (any version)</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.OracleDialect</font></tt></td>
        </tr>
        <tr>
            <td>Oracle 9i/10g</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.Oracle9Dialect</font></tt></td>
        </tr>
        <tr>
            <td>Sybase</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.SybaseDialect</font></tt></td>
        </tr>
        <tr>
            <td>Sybase Anywhere</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.SybaseAnywhereDialect</font></tt></td>
        </tr>
        <tr>
            <td>Microsoft SQL Server</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.SQLServerDialect</font></tt></td>
        </tr>
        <tr>
            <td>SAP DB</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.SAPDBDialect</font></tt></td>
        </tr>
        <tr>
            <td>Informix</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.InformixDialect</font></tt></td>
        </tr>
        <tr>
            <td>HypersonicSQL</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.HSQLDialect</font></tt></td>
        </tr>
        <tr>
            <td>Ingres</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.IngresDialect</font></tt></td>
        </tr>
        <tr>
            <td>Progress</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.ProgressDialect</font></tt></td>
        </tr>
        <tr>
            <td>Mckoi SQL</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.MckoiDialect</font></tt></td>
        </tr>
        <tr>
            <td>Interbase</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.InterbaseDialect</font></tt></td>
        </tr>
        <tr>
            <td>Pointbase</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.PointbaseDialect</font></tt></td>
        </tr>
        <tr>
            <td>FrontBase</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.FrontbaseDialect</font></tt></td>
        </tr>
        <tr>
            <td>Firebird</td>
            <td><tt><font face="新宋体">org.hibernate.dialect.FirebirdDialect</font></tt></td>
        </tr>
    </tbody>
</table>
</div>
</div>
<div></div>
<div>
<p><strong>表&nbsp;3.9.&nbsp; Hibernate日志类别 </strong></p>
<table summary="&amp;10;                    Hibernate日志类别&amp;10;                " border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>类别 </th>
            <th>功能 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.SQL</font></tt></td>
            <td>在所有SQL DML语句被执行时为它们记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.type</font></tt></td>
            <td>为所有JDBC参数记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.tool.hbm2ddl</font></tt></td>
            <td>在所有SQL DDL语句执行时为它们记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.pretty</font></tt></td>
            <td>在session清洗(flush)时，为所有与其关联的实体(最多20个)的状态记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.cache</font></tt></td>
            <td>为所有二级缓存的活动记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction</font></tt></td>
            <td>为事务相关的活动记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.jdbc</font></tt></td>
            <td>为所有JDBC资源的获取记录日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.hql.AST</font></tt></td>
            <td>在解析查询的时候,记录HQL和SQL的AST分析日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.secure</font></tt></td>
            <td>为JAAS认证请求做日志 </td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate</font></tt></td>
            <td>为任何Hibernate相关信息做日志 (信息量较大, 但对查错非常有帮助) </td>
        </tr>
    </tbody>
</table>
</div>
<div>
<p><strong>表&nbsp;3.10.&nbsp;JTA TransactionManagers</strong></p>
<table summary="JTA TransactionManagers" border="1">
    <colgroup>
    <col>
    <col></colgroup>
    <thead>
        <tr>
            <th>Transaction工厂类 </th>
            <th align="center">应用程序服务器 </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.JBossTransactionManagerLookup</font></tt></td>
            <td align="center">JBoss</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.WeblogicTransactionManagerLookup</font></tt></td>
            <td align="center">Weblogic</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.WebSphereTransactionManagerLookup</font></tt></td>
            <td align="center">WebSphere</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</font></tt></td>
            <td align="center">WebSphere 6</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.OrionTransactionManagerLookup</font></tt></td>
            <td align="center">Orion</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.ResinTransactionManagerLookup</font></tt></td>
            <td align="center">Resin</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.JOTMTransactionManagerLookup</font></tt></td>
            <td align="center">JOTM</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.JOnASTransactionManagerLookup</font></tt></td>
            <td align="center">JOnAS</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.JRun4TransactionManagerLookup</font></tt></td>
            <td align="center">JRun4</td>
        </tr>
        <tr>
            <td><tt><font face="新宋体">org.hibernate.transaction.BESTransactionManagerLookup</font></tt></td>
            <td align="center">Borland ES</td>
        </tr>
    </tbody>
</table>
</div>
</div>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/146442.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-09-19 13:28 <a href="http://www.blogjava.net/hllwuxin/archive/2007/09/19/146442.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Hibernate包祥解</title><link>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146441.html</link><dc:creator>優雅Ｄě頽廢</dc:creator><author>優雅Ｄě頽廢</author><pubDate>Wed, 19 Sep 2007 05:26:00 GMT</pubDate><guid>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146441.html</guid><wfw:comment>http://www.blogjava.net/hllwuxin/comments/146441.html</wfw:comment><comments>http://www.blogjava.net/hllwuxin/archive/2007/09/19/146441.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hllwuxin/comments/commentRss/146441.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hllwuxin/services/trackbacks/146441.html</trackback:ping><description><![CDATA[<div class="g_t_left c07 content" id="blogtext__fks_sffsilOSxkt7XcaYhGmeVKEcy4pTW4C2">
<p style="text-indent: 2em">Hibernate一共包括了23个jar包，令人眼花缭乱。本文将详细讲解Hibernate每个jar包的作用，便于你在应用中根据自己的需要进行取舍。 </p>
<p style="text-indent: 2em">　　下载Hibernate，例如2.0.3稳定版本，解压缩，可以看到一个hibernate2.jar和lib目录下有22个jar包： </p>
<p style="text-indent: 2em">　　hibernate2.jar: </p>
<p style="text-indent: 2em">　　Hibernate的库，没有什么可说的，必须使用的jar包 </p>
<p style="text-indent: 2em">　　cglib-asm.jar: </p>
<p style="text-indent: 2em">　　CGLIB库，Hibernate用它来实现PO字节码的动态生成，非常核心的库，必须使用的jar包 </p>
<p style="text-indent: 2em">　　dom4j.jar: </p>
<p style="text-indent: 2em">　　dom4j是一个Java的XML API，类似于jdom，用来读写XML文件的。dom4j是一个非常非常优秀的Java XML API，具有性能优异、功能强大和极端易用使用的特点，同时它也是一个开放源代码的软件，可以在SourceForge上找到它。在IBM developerWorks上面可以找到一篇文章，对主流的Java XML API进行的性能、功能和易用性的评测，dom4j无论在那个方面都是非常出色的。我早在将近两年之前就开始使用dom4j，直到现在。如今你可以看到越来越多的Java软件都在使用dom4j来读写XML，特别值得一提的是连Sun的JAXM也在用dom4j。这是必须使用的jar包，Hibernate用它来读写配置文件。 </p>
<p style="text-indent: 2em">　　odmg.jar: </p>
<p style="text-indent: 2em">　　ODMG是一个ORM的规范，Hibernate实现了ODMG规范，这是一个核心的库，必须使用的jar包。 </p>
<p style="text-indent: 2em">　　commons-collections.jar： </p>
<p style="text-indent: 2em">　　Apache Commons包中的一个，包含了一些Apache开发的集合类，功能比java.util.*强大。必须使用的jar包。 </p>
<p style="text-indent: 2em">　　commons-beanutils.jar： </p>
<p style="text-indent: 2em">　　Apache Commons包中的一个，包含了一些Bean工具类类。必须使用的jar包。 </p>
<p style="text-indent: 2em">　　commons-lang.jar: </p>
<p style="text-indent: 2em">　　Apache Commons包中的一个，包含了一些数据类型工具类，是java.lang.*的扩展。必须使用的jar包。 </p>
<p style="text-indent: 2em">　　commons-logging.jar: </p>
<p style="text-indent: 2em">　　Apache Commons包中的一个，包含了日志功能，必须使用的jar包。这个包本身包含了一个Simple Logger，但是功能很弱。在运行的时候它会先在CLASSPATH找log4j，如果有，就使用log4j，如果没有，就找JDK1.4带的java.util.logging，如果也找不到就用Simple Logger。commons-logging.jar的出现是一个历史的的遗留的遗憾，当初Apache极力游说Sun把log4j加入JDK1.4，然而JDK1.4项目小组已经接近发布JDK1.4产品的时间了，因此拒绝了Apache的要求，使用自己的java.util.logging，这个包的功能比log4j差的很远，性能也一般。</p>
<p style="text-indent: 2em">　　后来Apache就开发出来了commons-logging.jar用来兼容两个logger。因此用commons-logging.jar写的log程序，底层的Logger是可以切换的，你可以选择log4j，java.util.logging或者它自带的Simple Logger。不过我仍然强烈建议使用log4j，因为log4j性能很高，log输出信息时间几乎等于System.out，而处理一条log平均只需要5us。你可以在Hibernate的src目录下找到Hibernate已经为你准备好了的log4j的配置文件，你只需要到Apache 网站去下载log4j就可以了。commons-logging.jar也是必须的jar包。 </p>
<p style="text-indent: 2em">　　使用Hibernate必须的jar包就是以上的这几个，剩下的都是可选的。 </p>
<p style="text-indent: 2em">　　ant.jar: </p>
<p style="text-indent: 2em">　　Ant编译工具的jar包，用来编译Hibernate源代码的。如果你不准备修改和编译Hibernate源代码，那么就没有什么用，可选的jar包 </p>
<p style="text-indent: 2em">　　optional.jar： </p>
<p style="text-indent: 2em">　　Ant的一个辅助包。 </p>
<p style="text-indent: 2em">　　c3p0.jar： </p>
<p style="text-indent: 2em">　　C3PO是一个数据库连接池，Hibernate可以配置为使用C3PO连接池。如果你准备用这个连接池，就需要这个jar包。 </p>
<p style="text-indent: 2em">　　proxool.jar： </p>
<p style="text-indent: 2em">　　也是一个连接池，同上。 </p>
<p style="text-indent: 2em">　　commons-pool.jar, commons-dbcp.jar: </p>
<p style="text-indent: 2em">　　DBCP数据库连接池，Apache的Jakarta组织开发的，Tomcat4的连接池也是DBCP。 </p>
<p style="text-indent: 2em">　　实际上Hibernate自己也实现了一个非常非常简单的数据库连接池，加上上面3个，你实际上可以在Hibernate上选择4种不同的数据库连接池，选择哪一个看个人的偏好，不过DBCP可能更通用一些。另外强调一点，如果在EJB中使用Hibernate，一定要用App Server的连接池，不要用以上4种连接池，否则容器管理事务不起作用。 </p>
<p style="text-indent: 2em">　　connector.jar: </p>
<p style="text-indent: 2em">　　JCA 规范，如果你在App Server上把Hibernate配置为Connector的话，就需要这个jar。不过实际上一般App Server肯定会带上这个包，所以实际上是多余的包。 </p>
<p style="text-indent: 2em">　　jaas.jar: </p>
<p style="text-indent: 2em">　　JAAS是用来进行权限验证的，已经包含在JDK1.4里面了。所以实际上是多余的包。 </p>
<p style="text-indent: 2em">　　jcs.jar： </p>
<p style="text-indent: 2em">　　如果你准备在Hibernate中使用JCS的话，那么必须包括它，否则就不用。 </p>
<p style="text-indent: 2em">　　jdbc2_0-stdext.jar: </p>
<p style="text-indent: 2em">　　JDBC2.0的扩展包，一般来说数据库连接池会用上它。不过App Server都会带上，所以也是多余的。 </p>
<p style="text-indent: 2em">　　jta.jar： </p>
<p style="text-indent: 2em">　　JTA规范，当Hibernate使用JTA的时候需要，不过App Server都会带上，所以也是多余的。 </p>
<p style="text-indent: 2em">　　junit.jar: </p>
<p style="text-indent: 2em">　　Junit包，当你运行Hibernate自带的测试代码的时候需要，否则就不用。 </p>
<p style="text-indent: 2em">　　xalan.jar, xerces.jar, xml-apis.jar: </p>
<p style="text-indent: 2em">　　Xerces是XML解析器，Xalan是格式化器，xml-apis实际上是JAXP。一般App Server都会带上，JDK1.4也包含了解析器，不过不是Xerces，是Crimson，效率比较差，不过Hibernate用XML只不过是读取配置文件，性能没什么紧要的，所以也是多余的。</p>
</div>
<img src ="http://www.blogjava.net/hllwuxin/aggbug/146441.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hllwuxin/" target="_blank">優雅Ｄě頽廢</a> 2007-09-19 13:26 <a href="http://www.blogjava.net/hllwuxin/archive/2007/09/19/146441.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>