﻿<?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-Zhu Jun's Tech Weblog</title><link>http://www.blogjava.net/Johncn/</link><description /><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 01:18:25 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 01:18:25 GMT</pubDate><ttl>60</ttl><item><title>[Struts] 使用多个资源文件</title><link>http://www.blogjava.net/Johncn/archive/2006/01/07/27021.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Sat, 07 Jan 2006 12:46:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/07/27021.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/27021.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/07/27021.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/27021.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/27021.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 项目中实现多语言国际化都是通过使用&lt;bean:message&gt;标签和资源文件,但是如果把所有的页面说明都加入一个资源文件中,通常的后果是这个文件会越来越长,而且开发中不同的人加入的格式也不一直,到最后很可能是谁也不知道到底资源文件中有些什么内容,如果有新的开发人员加入的话,很可能只好再自己需要用到什么再继续加进文件.最后维护这样的文件变成很痛苦的事情.<BR>&nbsp;&nbsp;&nbsp; 所以想要使用多个资源文件,这样可以根据不同的划分规则(功能,位置,词性)将不同的内容放入不同的文件,方便维护.<BR>具体的做法:<BR><STRONG>1.创建属性文件并且在struts-config.xml中为每一个文件声明一个message-resources元素。</STRONG><BR></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #800000">message-resources<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff0000">parameter</SPAN><SPAN style="COLOR: #0000ff">="com.oreilly.strutsckbk.MessageResources"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #0000ff"><FONT face=Arial size=2>&lt;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #800000">message-resources&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff0000">parameter</SPAN><SPAN style="COLOR: #0000ff">="com.oreilly.strutsckbk.LabelResources"</SPAN></FONT></FONT><SPAN style="COLOR: #ff0000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;key</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">="labels"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">message-resources</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #0000ff"><FONT face=Arial size=2>&lt;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #800000">message-resources&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff0000">parameter</SPAN><SPAN style="COLOR: #0000ff">="com.oreilly.strutsckbk.HeaderResources"</SPAN></FONT></FONT><SPAN style="COLOR: #ff0000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;key</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">="headers"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">message-resources</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT></DIV><FONT face=Arial><FONT size=2><STRONG>注意</STRONG>:这里多了一个属性<STRONG>key</STRONG>,这就是用来在页面标签中区分不同的资源文件的,标签默认是使用没有说明<STRONG>key</STRONG>值的那个资源文件.<BR><BR><STRONG>2.使用&lt;bean:message&gt;标签:</STRONG><BR></FONT></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">bean:message&nbsp;</SPAN><SPAN style="COLOR: #ff0000">bundle</SPAN><SPAN style="COLOR: #0000ff">="labels"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;key</SPAN><SPAN style="COLOR: #0000ff">="label.url"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT></DIV><FONT face=Arial size=2>注意:这里的<STRONG>bundle</STRONG>属性就是用来指明上面提到的<STRONG>key</STRONG>属性的,以表明这个&lt;bean:message&gt;标签是要使用哪个资源文件.<BR><BR>说明:只能在struts1.1以上版本使用多个资源文件,struts1.0不支持&lt;message-resource&gt;属性,所以不能实现上面的用法.</FONT><img src ="http://www.blogjava.net/Johncn/aggbug/27021.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-07 20:46 <a href="http://www.blogjava.net/Johncn/archive/2006/01/07/27021.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Tomcat] 修改Tomcat端口号</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26406.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:42:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26406.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26406.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26406.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26406.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26406.html</trackback:ping><description><![CDATA[<DIV class=postcontent>
<P><FONT face=Arial size=2>安装了Oracle后,启动Tomcat时出现错误:</FONT></P>
<P><FONT face=Arial color=#ff0000 size=2>Error starting endpoint<BR>java.net.BindException: Address already in use: JVM_Bind:8080</FONT></P>
<P><FONT face=Arial color=#000000 size=2>原来Oracle的Servlet Engine也使用了8080端口.那就来修改Tomcat的端口:</FONT></P>
<P><FONT face=Arial size=2>首相找到<FONT color=#0000cc>Tomcat 5.0\conf\server.xml</FONT>文件,然后找到下面的代码:<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;port="8080"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxThreads="150"&nbsp;minSpareThreads="25"&nbsp;maxSpareThreads="75"<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enableLookups="false"&nbsp;redirectPort="8443"&nbsp;acceptCount="100"<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debug="0"&nbsp;connectionTimeout="20000"&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disableUploadTimeout="true"&nbsp;/&gt;</SPAN></DIV>
<P></FONT><FONT face=Arial size=2>修改&nbsp;port="8080" 为你想要的端口就可以了.</FONT></P></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/26406.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:42 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26406.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[TagLib] JSP自定义标签基础</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26405.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:37:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26405.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26405.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26405.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26405.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>自定义标签至少要实现一个接口:<FONT color=#0000cc>java.servlet.jsp.tagext.Tag</FONT>,我们通常是继承<FONT color=#0000cc>javax.servlet.jsp.tagext.TagSupport</FONT><FONT color=#000000>来实现</FONT>.</FONT></P>
<P><FONT face=Arial size=2></FONT><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?="">&nbsp;</P>
<P align=center><FONT face=Arial size=2><IMG alt=" " src="http://johncn.blogdriver.com/johncn/inc/clip_image001.gif" onload="function anonymous()&#13;&#10;{&#13;&#10; img_auto_size(this,450,true);&#13;&#10;}" align=baseline></FONT></SPAN></SPAN></SPAN></P>
<P><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><FONT face=Arial size=2>自定义标签的调用过程如下:</FONT></SPAN></SPAN></SPAN></P>
<P><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><FONT face=Arial size=2></FONT></SPAN></SPAN></SPAN></P>
<P align=center><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: " times="" new="" mso-bidi-language:="" mso-fareast-language:="" mso-ansi-language:="" 1.0pt;="" mso-font-kerning:="" 宋体;="" mso-fareast-font-family:="" 12.0pt;="" mso-bidi-font-size:="" roman?;="" en-us;="" zh-cn;="" ar-sa?=""><FONT face=Arial><FONT size=2><IMG alt=" " src="http://johncn.blogdriver.com/johncn/inc/clip_image003.gif" onload="function anonymous()&#13;&#10;{&#13;&#10; img_auto_size(this,450,true);&#13;&#10;}" align=baseline><STROKE joinstyle="miter" /><FORMULAS /><F eqn="if lineDrawn pixelLineWidth 0" /><F eqn="sum @0 1 0" /><F eqn="sum 0 0 @1" /><F eqn="prod @2 1 2" /><F eqn="prod @3 21600 pixelWidth" /><F eqn="prod @3 21600 pixelHeight" /><F eqn="sum @0 0 1" /><F eqn="prod @6 1 2" /><F eqn="prod @7 21600 pixelWidth" /><F eqn="sum @8 21600 0" /><F eqn="prod @7 21600 pixelHeight" /><F eqn="sum @10 21600 0" /></FORMULAS /><PATH o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /><LOCK v:ext="edit" aspectratio="t" /></SHAPETYPE /><SHAPE id=_x0000_i1025 style="WIDTH: 317.25pt; HEIGHT: 323.25pt" type="#_x0000_t75" /><IMAGEDATA src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\01\clip_image001.emz" o:title="" /></SHAPE /></FONT></FONT></SPAN></SPAN></SPAN></P><img src ="http://www.blogjava.net/Johncn/aggbug/26405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:37 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[JDBC] 常用JDBC连接字符串</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26404.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:35:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26404.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26404.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26404.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26404.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26404.html</trackback:ping><description><![CDATA[<DIV class=postcontent><SPAN class=bright-message-list><SPAN class=bright-message-list><FONT face=Arial><FONT size=2><STRONG>1. MySQL</STRONG><BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.gjt.mm.mysql.Driver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV><BR></FONT></FONT><FONT face=Arial><FONT size=2><STRONG>2. Microsoft SQLServer<BR></STRONG>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">com.microsoft.jdbc.sqlserver.SQLServerDriver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:1433;databaseName=master</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV><BR><STRONG>3. Oracle</STRONG>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><STRONG><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></STRONG><SPAN style="COLOR: #000000">Class.forName(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">oracle.jdbc.driver.OracleDriver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV></FONT></FONT></SPAN></SPAN><BR><FONT face=Arial><FONT size=2><STRONG>4.DB2</STRONG><BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">com.ibm.db2.jdbc.net.DB2Driver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;url</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:db2://192.9.200.108:6789/SAMPLE</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;url,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV><BR></FONT></FONT>
<P><FONT face=Arial><FONT size=2><STRONG>5. ODBC</STRONG><BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">sun.jdbc.odbc.JdbcOdbcDriver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Connection&nbsp;cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:odbc:</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;sDsn,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV>
<P><BR></FONT></FONT><FONT face=Arial><FONT size=2><STRONG>6. PostgreSQL<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.postgresql.Driver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;sUsr,&nbsp;sPwd&nbsp;);</SPAN></DIV></STRONG></FONT></FONT></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/26404.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:35 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26404.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[JDBC] DatabaseMetaDate接口</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26402.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:30:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26402.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26402.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26402.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26402.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26402.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>DatabaseMetaData 接口作为整体提供有关数据库的综合信息。 </FONT>
<P><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN style="FONT-WEIGHT: bold">从连Connection取得</SPAN><SPAN id=ArticleContent1_ArticleContent1_lblContent style="FONT-WEIGHT: bold">DatabaseMetaData </SPAN><SPAN style="FONT-WEIGHT: bold">:</SPAN> </FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">DatabaseMetaData&nbsp;dbmd</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">con.getMetaData();&nbsp;</SPAN></DIV>
<P><FONT face=Arial><FONT size=2>&nbsp;<STRONG><SPAN id=ArticleContent1_ArticleContent1_lblContent>DatabaseMetaData</SPAN>有以下常用方法 :</STRONG></FONT></FONT></P>
<P><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getDriverName()</FONT></SPAN> :取得驱动程序名</FONT></P>
<P><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getDatabaseProductName()</FONT></SPAN> :取得数据库名(如:MySql,Sql Server等)</FONT></P>
<P><!--StartFragment --><FONT face=Arial><FONT size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff><SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getSQLKeywords()</FONT></SPAN></FONT><FONT color=#000000> :取得SQL中的关键字</FONT></SPAN></FONT></FONT></P>
<P><SPAN><!--StartFragment --><FONT face=Arial><FONT size=2><SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>&nbsp;getMaxConnections()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>并发访问的用户个数</SPAN> </FONT></FONT></SPAN></P>
<P><SPAN><!--StartFragment --><FONT face=Arial><FONT size=2>&nbsp;<SPAN><FONT color=#0000ff>getNumericFunctions()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据库的所有数学函数的列表</SPAN></FONT></FONT></SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2>&nbsp;</FONT></SPAN></SPAN></P>
<P><FONT face=Arial><FONT size=2><SPAN><SPAN>&nbsp;<SPAN><FONT color=#0000ff>getStringFunctions()</FONT></SPAN> :<!--StartFragment --> <SPAN>数据库的所有字符串函数的列表</SPAN></SPAN></SPAN><SPAN><SPAN><SPAN><!--StartFragment -->&nbsp;</SPAN></SPAN></SPAN></FONT></FONT></P>
<P><SPAN><SPAN><SPAN><FONT face=Arial><FONT size=2><SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>&nbsp;getSystemFunctions()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据库的所有系统函数的列表</SPAN></FONT></FONT></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getTimeDateFunctions()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据库的所有日期时间函数的列表</SPAN> </FONT></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getTypeInfo()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据类型信息</SPAN> </FONT></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getTypeInfo();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())<BR><IMG id=Codehighlighter1_45_250_Open_Image onclick="this.style.display='none'; Codehighlighter1_45_250_Open_Text.style.display='none'; Codehighlighter1_45_250_Closed_Image.style.display='inline'; Codehighlighter1_45_250_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_45_250_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_45_250_Closed_Text.style.display='none'; Codehighlighter1_45_250_Open_Image.style.display='inline'; Codehighlighter1_45_250_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;</SPAN><SPAN id=Codehighlighter1_45_250_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_45_250_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;数据类型名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;数据类型：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;rs.getString(</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;精度：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;rs.getString(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;基数：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;rs.getString(</SPAN><SPAN style="COLOR: #000000">18</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN></DIV>
<P>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getURL()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据库的url</SPAN> </FONT></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getUserName()</FONT></SPAN> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>数据库的用户</SPAN> </FONT></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial><FONT size=2>&nbsp;<FONT color=#0000ff><SPAN id=ArticleContent1_ArticleContent1_lblContent>getTables</SPAN>()</FONT> :取得<SPAN id=ArticleContent1_ArticleContent1_lblContent>数据表信息</SPAN></FONT></FONT></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial><FONT size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG id=Codehighlighter1_16_34_Open_Image onclick="this.style.display='none'; Codehighlighter1_16_34_Open_Text.style.display='none'; Codehighlighter1_16_34_Closed_Image.style.display='inline'; Codehighlighter1_16_34_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_16_34_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_16_34_Closed_Text.style.display='none'; Codehighlighter1_16_34_Open_Image.style.display='inline'; Codehighlighter1_16_34_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #000000">&nbsp;String&nbsp;[&nbsp;]&nbsp;t&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN id=Codehighlighter1_16_34_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_16_34_Open_Text><SPAN style="COLOR: #000000">{&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">TABLE</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">VIEW</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getTables(</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HR</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">%</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;t);<BR><IMG id=Codehighlighter1_96_329_Open_Image onclick="this.style.display='none'; Codehighlighter1_96_329_Open_Text.style.display='none'; Codehighlighter1_96_329_Closed_Image.style.display='inline'; Codehighlighter1_96_329_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_96_329_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_96_329_Closed_Text.style.display='none'; Codehighlighter1_96_329_Open_Image.style.display='inline'; Codehighlighter1_96_329_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())</SPAN><SPAN id=Codehighlighter1_96_329_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_96_329_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">目录名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;模式名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表的类型：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;注释：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV>
<P>&nbsp;<SPAN id=ArticleContent1_ArticleContent1_lblContent><FONT color=#0000ff>getPrimaryKeys() </FONT><FONT color=#000000>:取得<!--StartFragment --><SPAN id=ArticleContent1_ArticleContent1_lblContent>主键信息</SPAN> </FONT></SPAN></FONT></FONT></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getPrimaryKeys(</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HR</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">EMPLOYEES</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG id=Codehighlighter1_68_351_Open_Image onclick="this.style.display='none'; Codehighlighter1_68_351_Open_Text.style.display='none'; Codehighlighter1_68_351_Closed_Image.style.display='inline'; Codehighlighter1_68_351_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_68_351_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_68_351_Closed_Text.style.display='none'; Codehighlighter1_68_351_Open_Image.style.display='inline'; Codehighlighter1_68_351_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())</SPAN><SPAN id=Codehighlighter1_68_351_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_68_351_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">目录名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;模式名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;列名顺序号：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;列名顺序号：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;主键名：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">6</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV>
<P>&nbsp;<FONT color=#0000ff><SPAN id=ArticleContent1_ArticleContent1_lblContent>getTableTypes()</SPAN></FONT> :<!--StartFragment --> 取得<!--StartFragment --><SPAN id=ArticleContent1_ArticleContent1_lblContent>表的类型</SPAN> </FONT></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getTableTypes();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表的类型有：</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;rs.getString(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;System.out.println();&nbsp;</SPAN></DIV>
<P>&nbsp;<FONT color=#0000ff><SPAN id=ArticleContent1_ArticleContent1_lblContent>getColumns()<FONT color=#000000> :<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>列信息</SPAN>&nbsp;</FONT></SPAN></FONT> </FONT></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><SPAN><!--StartFragment --><FONT face=Arial size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getColumns(</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HR</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">EMPLOYEES</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">%</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG id=Codehighlighter1_70_526_Open_Image onclick="this.style.display='none'; Codehighlighter1_70_526_Open_Text.style.display='none'; Codehighlighter1_70_526_Closed_Image.style.display='inline'; Codehighlighter1_70_526_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_70_526_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_70_526_Closed_Text.style.display='none'; Codehighlighter1_70_526_Open_Image.style.display='inline'; Codehighlighter1_70_526_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())</SPAN><SPAN id=Codehighlighter1_70_526_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_70_526_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表名&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;列名&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;数据类型</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;本地类型名</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">6</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;列的大小</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">7</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;小数位数</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">9</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;数据基数</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;是否可空</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">11</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;索引号</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">17</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV>
<P>&nbsp;<FONT color=#0000ff>getIndexInfo()<FONT color=#000000> :<!--StartFragment -->&nbsp;<!--StartFragment --> <SPAN id=ArticleContent1_ArticleContent1_lblContent>索引信息</SPAN>&nbsp;</FONT></FONT> </P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;rs&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;dbmd.getIndexInfo(</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HR</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">EMPLOYEES</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">);<BR><IMG id=Codehighlighter1_81_341_Open_Image onclick="this.style.display='none'; Codehighlighter1_81_341_Open_Text.style.display='none'; Codehighlighter1_81_341_Closed_Image.style.display='inline'; Codehighlighter1_81_341_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_81_341_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_81_341_Closed_Text.style.display='none'; Codehighlighter1_81_341_Open_Image.style.display='inline'; Codehighlighter1_81_341_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(rs.next())</SPAN><SPAN id=Codehighlighter1_81_341_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_81_341_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;表名</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;索引名</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">6</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;索引类型</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">7</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;索引列名</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">9</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;索引顺序</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">rs.getString(</SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN></DIV></FONT></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><img src ="http://www.blogjava.net/Johncn/aggbug/26402.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:30 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26402.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Velocity] Velocity 参考资料</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26400.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:25:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26400.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26400.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26400.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26400.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26400.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Velocity 参考资料 John Zhu 2005-4-7 &nbsp;原文:http://jakarta.apache.org/velocity/user-guide.html VTL Reference: http://jakarta.apache.org/velocity/vtl-reference-guide.html Develop...&nbsp;&nbsp;<a href='http://www.blogjava.net/Johncn/archive/2006/01/02/26400.html'>阅读全文</a><img src ="http://www.blogjava.net/Johncn/aggbug/26400.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:25 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26400.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Eclipse] 在Eclipse中安装Visual Editor插件</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26398.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:22:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26398.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26398.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26398.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26398.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26398.html</trackback:ping><description><![CDATA[<DIV class=postcontent><FONT face=Arial size=2>在Eclipse中进行GUI开发需要安装Visual Editor插件:<BR>1.Install Omondo UML(包括了VE插件所需要的EMF,GEF,还包括UML2插件):<BR></FONT>
<UL>
<LI><FONT face=Arial size=2>到</FONT><A href="http://www.omondo.com/download/index.html"><FONT face=Arial color=#002c99 size=2>http://www.omondo.com/download/index.html</FONT></A><FONT face=Arial size=2>下载eclipseUML_E302_freeEdition_2.0.0.20050407.jar; </FONT>
<LI><FONT face=Arial><FONT size=2>Install by <CODE><FONT face=Arial size=3>java -jar eclipseUML_E301_freeEdition_2.0.0.beta.20041026.jar</FONT>;<SPAN style="FONT-FAMILY: verdana,sans-serif"></SPAN></CODE></FONT></FONT></LI></UL><FONT size=2><FONT face=Arial><SPAN style="FONT-FAMILY: verdana,sans-serif">2.Install </SPAN>Visual Editor插件:<BR></FONT></FONT>
<UL>
<LI><FONT face=Arial size=2>到</FONT><A href="http://www.eclipse.org/vep/"><FONT face=Arial color=#002c99 size=2>http://www.eclipse.org/vep/</FONT></A><FONT face=Arial size=2>下载VE-runtime-1.0.2.1.zip; </FONT>
<LI><FONT face=Arial size=2>将VE -runtime-1.0.2.1.zip解压到c:\eclipse-plugins(可以是任何目录)下,在Eclipse的安装路径下的links 目录中建立一个link文件,比如gui.ve.link,文件内容为&nbsp;&nbsp;path=c:/eclipse-plugins/VE-runtime- 1.0.2.1, 即这个link文件要对应一个刚解压后的插件目录。(注意:此目录中应包含eclipse/(features|plugins)结构); </FONT>
<LI><FONT face=Arial size=2>启动eclipse即可,安装完成;</FONT></LI></UL>
<P><FONT face=Arial size=2>3.后期设置: </FONT></P>
<UL>
<LI><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体"><SPAN style="FONT-FAMILY: 宋体">点击</SPAN><SPAN lang=EN-US>Window</SPAN><SPAN style="FONT-FAMILY: 宋体">菜单，选择</SPAN><SPAN lang=EN-US>Customize Perspective…</SPAN></SPAN> </FONT></FONT>
<LI><SPAN style="FONT-FAMILY: 宋体"><SPAN lang=EN-US></SPAN></SPAN><SPAN lang=EN-US></SPAN><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Submenus</SPAN><SPAN style="FONT-FAMILY: 宋体">栏目下选择</SPAN><SPAN lang=EN-US style="COLOR: blue">New</SPAN> </FONT></FONT>
<LI><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Shortcut Categories</SPAN><SPAN style="FONT-FAMILY: 宋体">下选择</SPAN><SPAN lang=EN-US style="COLOR: blue">Java</SPAN> </FONT></FONT>
<LI><SPAN lang=EN-US style="COLOR: blue"></SPAN><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Shortcuts</SPAN><SPAN style="FONT-FAMILY: 宋体">中在</SPAN><SPAN lang=EN-US style="COLOR: blue">Visual Class</SPAN><SPAN style="FONT-FAMILY: 宋体">前划勾</SPAN> </FONT></FONT>
<LI><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Submenus</SPAN><SPAN style="FONT-FAMILY: 宋体">栏目下选择</SPAN><SPAN lang=EN-US style="COLOR: blue">Show View</SPAN> </FONT></FONT>
<LI><SPAN lang=EN-US style="COLOR: blue"></SPAN><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Shortcut Categories</SPAN><SPAN style="FONT-FAMILY: 宋体">下选择</SPAN><SPAN lang=EN-US style="COLOR: blue">Basic</SPAN> </FONT></FONT>
<LI><SPAN lang=EN-US style="COLOR: blue"></SPAN><FONT face=Arial><FONT size=2><SPAN lang=EN-US>Shortcuts</SPAN><SPAN style="FONT-FAMILY: 宋体">中在</SPAN><SPAN lang=EN-US style="COLOR: blue">Palette</SPAN><SPAN style="FONT-FAMILY: 宋体">前划勾</SPAN> </FONT></FONT>
<LI><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体">通过菜单调出<SPAN lang=EN-US>Palette</SPAN><SPAN style="FONT-FAMILY: 宋体">：</SPAN><SPAN lang=EN-US>Window | Show View | Palette</SPAN></SPAN> </FONT></FONT>
<LI><SPAN style="FONT-FAMILY: 宋体"><SPAN lang=EN-US><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体">从<SPAN lang=EN-US>Menu</SPAN>打开</SPAN><SPAN lang=EN-US>Properties View<SPAN style="FONT-FAMILY: 宋体">：<SPAN lang=EN-US style="COLOR: blue">Windows | Show View | Basic | Properties</SPAN></SPAN></SPAN></FONT></FONT></SPAN></SPAN></LI></UL>
<P><FONT face=Arial size=2>好了,现在new-&gt;Visual Class就可以进行GUI的开发了.</FONT></P></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/26398.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:22 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26398.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Velocity] Velocity中遇到的一个问题</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26394.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:18:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26394.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26394.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26394.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26394.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>在模板中老是访问不到对象的属性,最后发现原来是应为模板中访问的对象不是一个Public类,<FONT color=#ff3300>将Class改为Public</FONT>后一切OK.后来分析可能是因为访问权限的问题,当Class未加Public时,是包内可访问(friendly),而模板如果与对象的Class不在同一包中时自然访问不到. </FONT><img src ="http://www.blogjava.net/Johncn/aggbug/26394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:18 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Hibernate] 为Hibernate提供JDBC连接</title><link>http://www.blogjava.net/Johncn/archive/2006/01/02/26392.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:15:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2006/01/02/26392.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/26392.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2006/01/02/26392.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/26392.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/26392.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>可以通过3钟方式为Hibernate提供JDBC连接:</FONT></P>
<P><FONT face=Arial color=#000000 size=2>1.直接提供JDBC连接对象Connection:</FONT></P>
<P><SPAN lang=EN-US style="FONT-SIZE: 8.5pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体"><FONT color=#000000><FONT face=Arial><FONT size=2></P>
<P></P>
<P></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">Class.forName(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">com.mysql.jdbc.Driver</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;url&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">jdbc:mysql://localhost:3306/HibernateTest?user=root&amp;password=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>java.sql.Connection&nbsp;conn&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DriverManager.getConnection(url);&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SessionFactory&nbsp;sessionFactory&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;cfg.buildSessionFactory();&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Session&nbsp;session&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;sessionFactory.openSession(conn);</SPAN></DIV>
<P>2.<SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">通过属性文件</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体; mso-bidi-font-size: 12.0pt">hibernate.properties</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">配置</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体; mso-bidi-font-size: 12.0pt">JDBC</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">来源:</SPAN></FONT></FONT></FONT></SPAN></P><SPAN lang=EN-US style="FONT-SIZE: 8.5pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体"><FONT color=#0000ff><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt"><SPAN lang=EN-US style="FONT-SIZE: 8.5pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">
<P><SPAN lang=EN-US style="FONT-SIZE: 8.5pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体"><FONT color=#000000><FONT face=Arial><FONT size=2></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">hibernate.show_sql&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>hibernate.dialect&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;net.sf.hibernate.dialect.MySQLDialect&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>hibernate.connection.driver_class&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;com.mysql.jdbc.Driver&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>hibernate.connection.url&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;jdbc:mysql:</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">localhost/HibernateTest&nbsp;</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">hibernate.connection.username&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;root<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>hibernate.connection.password&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV>
<P>3.<SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">通<SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">过</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体; mso-bidi-font-size: 12.0pt">XML</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">文件</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体; mso-bidi-font-size: 12.0pt">hibernate.cfg.xml</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">进行配置</SPAN></SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">:<BR><BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;?</SPAN><SPAN style="COLOR: #ff00ff">xml&nbsp;version='1.0'&nbsp;encoding='big5'</SPAN><SPAN style="COLOR: #0000ff">?&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;!</SPAN><SPAN style="COLOR: #ff00ff">DOCTYPE&nbsp;hibernate-configuration&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;PUBLIC&nbsp;"-//Hibernate/Hibernate&nbsp;Configuration&nbsp;DTD//EN"&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">hibernate-configuration</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">session-factory</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;显示实际操作数据库时的SQL&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="show_sql"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">true</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;SQL方言，这边设定的是MySQL&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="dialect"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">net.sf.hibernate.dialect.MySQLDialect</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;JDBC驱动程序&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="connection.driver_class"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">com.mysql.jdbc.Driver</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;JDBC&nbsp;URL&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="connection.url"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">jdbc:mysql://localhost/HibernateTest</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;数据库使用者&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="connection.username"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">caterpillar</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;数据库密码&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="connection.password"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">123456</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000">&nbsp;对象与数据库表格映像文件&nbsp;</SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">mapping&nbsp;</SPAN><SPAN style="COLOR: #ff0000">resource</SPAN><SPAN style="COLOR: #0000ff">="User.hbm.xml"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">session-factory</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">hibernate-configuration</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></DIV></SPAN></FONT></FONT></FONT></SPAN></SPAN></SPAN></FONT></SPAN><img src ="http://www.blogjava.net/Johncn/aggbug/26392.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:15 <a href="http://www.blogjava.net/Johncn/archive/2006/01/02/26392.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[发掘Jakarta Commons] 使用StringUtil类</title><link>http://www.blogjava.net/Johncn/archive/2005/12/27/25619.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Tue, 27 Dec 2005 11:35:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/27/25619.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/25619.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/27/25619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/25619.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/25619.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>org.apache.commons.lang.StringUtils中提供许多有用的字符串操作方法，了解这些方法，我们可以避免许多不必要的重复工作。下面介绍其中比较有用的几个方法：<BR><BR></FONT><STRONG><FONT face=Arial size=2>检查空字符串：<BR></FONT></P></STRONG>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>StringUtils.isBlank(String&nbsp;str);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>StringUtils.isNotBlank(String&nbsp;str);</FONT></SPAN></DIV>
<P><FONT face=Arial><FONT size=2><STRONG>缩写字符串：</STRONG><BR></FONT></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String&nbsp;test&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">This&nbsp;is&nbsp;a&nbsp;test&nbsp;of&nbsp;the&nbsp;abbreviation.</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>System.out.println(&nbsp;StringUtils.abbreviate(&nbsp;test,&nbsp;</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>10</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>[Console输出]<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>This&nbsp;is<IMG src="http://www.blogjava.net/images/dot.gif"></FONT></SPAN></DIV><STRONG><FONT face=Arial size=2>查找嵌套字符串：<BR></FONT></STRONG>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String&nbsp;htmlContent&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;html&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&lt;head&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;Test&nbsp;Page&lt;/title&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&lt;/head&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&lt;body&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;This&nbsp;is&nbsp;a&nbsp;TEST!&lt;/p&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&lt;/body&gt;\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;/html&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;Extract&nbsp;the&nbsp;title&nbsp;from&nbsp;this&nbsp;XHTML&nbsp;content&nbsp;</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">String&nbsp;title&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.substringBetween(htmlContent,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;title&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;/title&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>System.out.println(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Title:&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;title&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>[Console输出]<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Title:&nbsp;Test&nbsp;Page</FONT></SPAN></DIV><STRONG><FONT face=Arial size=2>验证字符串：<BR></FONT></STRONG>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String&nbsp;test1&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ORANGE</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;test2&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ICE9</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;test3&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ICE&nbsp;CREAM</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;test4&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">820B&nbsp;Judson&nbsp;Avenue</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000">&nbsp;t1val&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.isAlpha(&nbsp;test1&nbsp;);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;returns&nbsp;true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000">&nbsp;t2val&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.isAlphanumeric(&nbsp;test2&nbsp;);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;returns&nbsp;true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000">&nbsp;t3val&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.isAlphaSpace(&nbsp;test3&nbsp;);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;returns&nbsp;true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000">&nbsp;t4val&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;StringUtils.isAlphanumericSpace(&nbsp;test4&nbsp;);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;returns&nbsp;true</SPAN></FONT></FONT></DIV><FONT face=Arial><FONT size=2><STRONG>计算字符串出现频率：</STRONG>StringUtils.countMatches()</FONT></FONT><A name=jakartackbk-CHP-2-ITERM-2064></A><FONT face=Arial size=2> </FONT><A name=jakartackbk-CHP-2-ITERM-2065></A><BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">File&nbsp;manuscriptFile&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;File(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">manuscript.txt</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Reader&nbsp;reader&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;FileReader(&nbsp;manuscriptFile&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>StringWriter&nbsp;stringWriter&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;StringWriter(&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_177_211_Open_Image onclick="this.style.display='none'; Codehighlighter1_177_211_Open_Text.style.display='none'; Codehighlighter1_177_211_Closed_Image.style.display='inline'; Codehighlighter1_177_211_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_177_211_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_177_211_Closed_Text.style.display='none'; Codehighlighter1_177_211_Open_Image.style.display='inline'; Codehighlighter1_177_211_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(&nbsp;reader.ready(&nbsp;)&nbsp;)&nbsp;</SPAN><SPAN id=Codehighlighter1_177_211_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_177_211_Open_Text><SPAN style="COLOR: #000000">{&nbsp;writer.write(&nbsp;reader.read(&nbsp;)&nbsp;);&nbsp;}</SPAN></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;manuscript&nbsp;</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>=</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;stringWriter.toString(&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;Convert&nbsp;string&nbsp;to&nbsp;lowercase</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>manuscript&nbsp;</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>=</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;StringUtils.lowerCase(manuscript);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;count&nbsp;the&nbsp;occurrences&nbsp;of&nbsp;"futility"</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;numFutility&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.countMatches(&nbsp;manuscript,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">futility</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN></DIV><FONT face=Arial size=2><STRONG>比较不同字符串：<BR></STRONG></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><STRONG><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></STRONG><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;dist&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.getLevenshteinDistance(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>String&nbsp;diff&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.difference(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;index&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;StringUtils.indexOfDifference(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>System.out.println(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Edit&nbsp;Distance:&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dist&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>System.out.println(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Difference:&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;diff&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>System.out.println(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Diff&nbsp;Index:&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;index&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>[Console输出]<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Edit&nbsp;Distance:&nbsp;</SPAN><SPAN style="COLOR: #000000">2</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Difference:&nbsp;ld<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Diff&nbsp;Index:&nbsp;</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>3</FONT></SPAN></DIV><BR>
<HR>
<BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">参考资料：<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>《Jakarta&nbsp;Commons&nbsp;Cookbook》<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>By&nbsp;Timothy&nbsp;M.&nbsp;O'Brien&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Publisher&nbsp;:&nbsp;O'Reilly&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Pub&nbsp;Date&nbsp;:&nbsp;November&nbsp;</SPAN><SPAN style="COLOR: #000000">2004</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>ISBN&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">596</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">00706</SPAN><SPAN style="COLOR: #000000">-X&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Pages&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">400</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/25619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-27 19:35 <a href="http://www.blogjava.net/Johncn/archive/2005/12/27/25619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Oracle] Oracle中的dual表</title><link>http://www.blogjava.net/Johncn/archive/2005/12/26/25503.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 26 Dec 2005 14:28:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/26/25503.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/25503.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/26/25503.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/25503.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/25503.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>Oracle中的有一个很特殊的表:Dual Table.这个表中只含有一行记录,并且我们可以用这个表来检测许多Oracle的功能,比如:</FONT></P>
<P><FONT face=Arial size=2></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">789.65</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">123</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">789.65</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">123</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">--------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">97126.95</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">abs</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">-</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">890.98</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #ff00ff">ABS</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">-</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">890.98</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">----------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">890.98</SPAN></FONT></FONT></DIV>
<P><FONT face=Arial size=2>更特别的的是dual表中只含有一行记录,我们可以通过 desc 函数查看dual表的结构:</FONT></P>
<P><FONT face=Arial size=2></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">desc</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是否为空?&nbsp;类型<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">---------------------------------------&nbsp;--------&nbsp;------------------------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">DUMMY</SPAN><SPAN style="COLOR: #000000">&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">VARCHAR2</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN><SPAN style="COLOR: #000000">)</SPAN></FONT></FONT></DIV>
<P><FONT face=Arial size=2>查询dual表中的数据:</FONT></P>
<P><FONT face=Arial size=2></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;dual&nbsp;;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>DU<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #008080">--<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">X</SPAN></FONT></FONT></DIV>
<P><FONT face=Arial size=2>我们向dual中插入一条记录后再查询,看情况会如何:</FONT></P>
<P><FONT face=Arial size=2></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>DU<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #008080"><FONT face=Arial size=2>--<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">X<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">insert</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">into</SPAN><SPAN style="COLOR: #000000">&nbsp;dual&nbsp;</SPAN><SPAN style="COLOR: #0000ff">values</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #ff0000">'</SPAN><SPAN style="COLOR: #ff0000">Y</SPAN><SPAN style="COLOR: #ff0000">'</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>已创建&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;行。<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>DU<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #008080"><FONT face=Arial size=2>--<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">X<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">count</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">COUNT</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">--------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">2</SPAN></FONT></FONT></DIV>
<P><FONT face=Arial size=2>可见尽管insert语句插入记录后dual中有两条记录,但只能select出第一条记录.</FONT></P>
<P><FONT face=Arial size=2>同样我们再试试update和delete语句:</FONT></P>
<P><FONT face=Arial size=2></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">update</SPAN><SPAN style="COLOR: #000000">&nbsp;dual&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">dummy</SPAN><SPAN style="COLOR: #808080">=</SPAN><SPAN style="COLOR: #ff0000">'</SPAN><SPAN style="COLOR: #ff0000">Z</SPAN><SPAN style="COLOR: #ff0000">'</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>已更新&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;行。<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>DU<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #008080"><FONT face=Arial size=2>--<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">Z<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">count</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">COUNT</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">--------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">2</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">delete</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>已删除&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;行。<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>DU<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #008080"><FONT face=Arial size=2>--<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">Y<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>SQL</SPAN><SPAN style="COLOR: #808080">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">select</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">count</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">from</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;dual;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #ff00ff">COUNT</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #808080">*</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">--------</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN></FONT></FONT></DIV>
<P><FONT face=Arial size=2>可见每次操作只能影响到第一条记录(尽管select , update , delete 所针对的范围是整个表).</FONT></P><img src ="http://www.blogjava.net/Johncn/aggbug/25503.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-26 22:28 <a href="http://www.blogjava.net/Johncn/archive/2005/12/26/25503.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Oracle] Oracle exp/imp导出导入工具的使用 [转] </title><link>http://www.blogjava.net/Johncn/archive/2005/12/26/25502.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 26 Dec 2005 14:19:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/26/25502.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/25502.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/26/25502.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/25502.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/25502.html</trackback:ping><description><![CDATA[<FONT face=Arial><FONT size=2><STRONG>导出工具 exp</STRONG> <BR><BR>1. 它是操作系统下一个可执行的文件 存放目录/ORACLE_HOME/bin<BR><BR>exp导出工具将数据库中数据备份压缩成一个二进制系统文件.可以在不同OS间迁移<BR><BR>它有三种模式：<BR>a. 用户模式： 导出用户所有对象以及对象中的数据；<BR>b. 表模式： 导出用户所有表或者指定的表；<BR>c. 整个数据库： 导出数据库中所有对象。<BR><BR>2. 导出工具exp交互式命令行方式的使用的例子<BR><BR>$exp test/test123@appdb<BR>Enter array fetch buffer size: 4096 &gt; 回车<BR>Export file: expdat.dmp &gt; m.dmp 生成导出的文件名 <BR>(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U &gt; 3<BR>Export table data (yes/no): yes &gt; 回车<BR>Compress extents (yes/no): yes &gt; 回车<BR>Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set<BR>About to export specified tables via Conventional Path ...<BR>Table(T) or Partition(T<IMG alt=Razz src="http://www.cybercorlin.net/forum/images/smilies/razz.gif" align=middle>) to be exported: (RETURN to quit) &gt; cmamenu 要导出的表名<BR>. . exporting table CMAMENU 4336 rows exported<BR>Table(T) or Partition(T<IMG alt=Razz src="http://www.cybercorlin.net/forum/images/smilies/razz.gif" align=middle>) to be exported: (RETURN to quit) &gt;要导出的表名n<BR>Table(T) or Partition(T<IMG alt=Razz src="http://www.cybercorlin.net/forum/images/smilies/razz.gif" align=middle>) to be exported: (RETURN to quit) &gt; 回车<BR>Export terminated successfully without warnings. <BR><BR>3. 导出工具exp非交互式命令行方式的例子<BR><BR>$exp scott/tiger tables=(emp,dept) file=/directory/scott.dmp grants=y <BR><BR>说明:把scott用户里两个表emp,dept导出到文件/directory/scott.dmp<BR><BR>$exp scott/tiger tables=emp query="where job='salesman' and sal&lt;1600" file=/directory/scott2.dmp <BR><BR>说明:在exp里面加上导出emp的查询条件job='salesman' and sal&lt;1600<BR><BR>(但我个人很少这样用,还是把满足条件的记录生成临时表后,再exp会方便一些)<BR><BR>$exp parfile=username.par file=/directory1/username_1.dmp,/directory1/username_2.dmp filesize=2000M log=/directory2/username_exp.log<BR><BR>参数文件username.par内容<BR>userid=username/userpassword<BR>buffer=8192000<BR>compress=n<BR>grants=y<BR><BR>说明:username.par为导出工具exp用的参数文件,里面具体参数可以根据需要去修改<BR><BR>filesize指定生成的二进制备份文件的最大字节数<BR><BR>(可用来解决某些OS下2G物理文件的限制及加快压缩速度和方便刻历史数据光盘等)<BR><BR><STRONG>导入工具 imp</STRONG><BR><BR>1. 它是操作系统下一个可执行的文件 存放目录/ORACLE_HOME/bin<BR><BR>imp导入工具将EXP形成的二进制系统文件导入到数据库中.<BR><BR>它有三种模式：<BR>a. 用户模式： 导出用户所有对象以及对象中的数据；<BR>b. 表模式： 导出用户所有表或者指定的表；<BR>c. 整个数据库： 导出数据库中所有对象。<BR><BR>只有拥有IMP_FULL_DATABASE和DBA权限的用户才能做整个数据库导入<BR><BR>imp步骤：<BR>(1) create table (2) insert data (3) create index (4) create triggers,constraints<BR><BR>2.导入工具imp交互式命令行方式的例子<BR>$ imp<BR>Import: Release 8.1.6.0.0 - Production on 星期五 12月 7 17:01:08 2001<BR>(c) Copyright 1999 Oracle Corporation. All rights reserved.<BR>用户名: test<BR>口令:****<BR>连接到: Oracle8i Enterprise Edition Release 8.1.6.0.0 - bit Production<BR>With the Partitioning option<BR>JServer Release 8.1.6.0.0 - Production<BR>导入文件: expdat.dmp&gt; /tmp/m.dmp<BR>输入插入缓冲区大小（最小为 8192 ) 30720&gt;<BR>经由常规路径导出由EXPORT:V08.01.06创建的文件<BR>警告: 此对象由 TEST 导出, 而不是当前用户<BR>已经完成ZHS16GBK字符集和ZHS16GBK NCHAR 字符集中的导入<BR>只列出导入文件的内容(yes/no)：no&gt;<BR>由于对象已存在, 忽略创建错误(yes/no)：no&gt; yes<BR>导入权限(yes/no)：yes&gt;<BR>导入表数据(yes/no)：yes&gt;<BR>导入整个导出文件(yes/no)：no&gt; yes<BR>. 正在将TEST的对象导入到 SCOTT<BR>. . 正在导入表 "CMAMENU" 4336行被导入<BR>成功终止导入，但出现警告。 <BR><BR><BR>3.导入工具imp非交互式命令行方式的例子<BR><BR>$ imp system/manager fromuser=jones tables=(accts) <BR>$ imp system/manager fromuser=scott tables=(emp,dept) <BR>$ imp system/manager fromuser=scott touser=joe tables=emp <BR>$ imp scott/tiger file = expdat.dmp full=y <BR>$ imp scott/tiger file = /mnt1/t1.dmp show=n buffer=2048000 ignore=n commit=y grants=y full=y log=/oracle_backup/log/imp_scott.log<BR>$ imp system/manager parfile=params.dat <BR>params.dat 内容 <BR>file=dba.dmp show=n ignore=n grants=y fromuser=scott tables=(dept,emp) <BR><BR>4.导入工具imp可能出现的问题<BR><BR>(1) 数据库对象已经存在<BR>一般情况, 导入数据前应该彻底删除目标数据下的表, 序列, 函数/过程,触发器等; <BR>数据库对象已经存在, 按缺省的imp参数, 则会导入失败<BR>如果用了参数ignore=y, 会把exp文件内的数据内容导入<BR>如果表有唯一关键字的约束条件, 不合条件将不被导入<BR>如果表没有唯一关键字的约束条件, 将引起记录重复<BR><BR>(2) 数据库对象有主外键约束<BR>不符合主外键约束时, 数据会导入失败 <BR>解决办法: 先导入主表, 再导入依存表<BR>disable目标导入对象的主外键约束, 导入数据后, 再enable它们<BR>(3) 权限不够<BR>如果要把A用户的数据导入B用户下, A用户需要有imp_full_database权限<BR><BR>(4) 导入大表( 大于80M ) 时, 存储分配失败<BR>默认的EXP时, compress = Y, 也就是把所有的数据压缩在一个数据块上.<BR>导入时, 如果不存在连续一个大数据块, 则会导入失败.<BR>导出80M以上的大表时, 记得compress= N, 则不会引起这种错误.<BR><BR>(5) imp和exp使用的字符集不同<BR>如果字符集不同, 导入会失败, 可以改变unix环境变量或者NT注册表里NLS_LANG相关信息.<BR>导入完成后再改回来.<BR><BR>(6) imp和exp版本不能往上兼容<BR>imp可以成功导入低版本exp生成的文件, 不能导入高版本exp生成的文件<BR>根据情况我们可以用<BR>$ imp username/password@connect_string<BR>说明: connect_string 是在/ORACLE_HOME/network/admin/tnsnames.ora<BR>定义的本地或者远端数据库的名称<BR>注意事项:<BR>UNIX: /etc/hosts 要定义本地或者远端数据库服务器的主机名<BR>win98: windowshosts 和IP地址的对应关系 <BR><BR>win2000: winntsystem32driversetchosts </FONT></FONT><img src ="http://www.blogjava.net/Johncn/aggbug/25502.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-26 22:19 <a href="http://www.blogjava.net/Johncn/archive/2005/12/26/25502.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Hibernate笔记] 组件(Component)映射</title><link>http://www.blogjava.net/Johncn/archive/2005/12/22/25115.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Thu, 22 Dec 2005 10:46:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/22/25115.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/25115.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/22/25115.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/25115.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/25115.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2><STRONG>组件(Component)映射</STRONG>多用来表示对象的从属关系(<STRONG>组合,聚合</STRONG>).比如一个学生可能有<STRONG>姓名,年龄,性别,成绩</STRONG>等属性,其中成绩是另一个对象,又有<STRONG>科目,分数</STRONG>属性,这里就需要用组件映射来表是之间的关系.<BR><BR>Java代码:<BR></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;学生</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG id=Codehighlighter1_19_115_Open_Image onclick="this.style.display='none'; Codehighlighter1_19_115_Open_Text.style.display='none'; Codehighlighter1_19_115_Closed_Image.style.display='inline'; Codehighlighter1_19_115_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_19_115_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_19_115_Closed_Text.style.display='none'; Codehighlighter1_19_115_Open_Image.style.display='inline'; Codehighlighter1_19_115_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;Student</SPAN><SPAN id=Codehighlighter1_19_115_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN></FONT></FONT><SPAN id=Codehighlighter1_19_115_Open_Text><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;String&nbsp;name;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;age;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;String&nbsp;sex;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;Grade&nbsp;grade;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><IMG src="http://www.blogjava.net/images/dot.gif"><IMG src="http://www.blogjava.net/images/dot.gif"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</FONT></SPAN></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;成绩</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG id=Codehighlighter1_134_192_Open_Image onclick="this.style.display='none'; Codehighlighter1_134_192_Open_Text.style.display='none'; Codehighlighter1_134_192_Closed_Image.style.display='inline'; Codehighlighter1_134_192_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_134_192_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_134_192_Closed_Text.style.display='none'; Codehighlighter1_134_192_Open_Image.style.display='inline'; Codehighlighter1_134_192_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;Grade</SPAN><SPAN id=Codehighlighter1_134_192_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN></FONT></FONT><SPAN id=Codehighlighter1_134_192_Open_Text><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;String&nbsp;subject;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">float</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;score;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><IMG src="http://www.blogjava.net/images/dot.gif"><IMG src="http://www.blogjava.net/images/dot.gif"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</FONT></SPAN></SPAN></DIV>
<P><FONT face=Arial size=2>数据库:<BR></FONT></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">&nbsp;学生表</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">create</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">table</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;STUDENT&nbsp;(&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">char</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">32</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #808080">not</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;NAME&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">varchar</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">16</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #808080">not</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;SEX&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">char</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">1</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">),&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;AGE&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">integer</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">primary</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">key</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;(ID)&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">--</SPAN><SPAN style="COLOR: #008080">&nbsp;成绩表</SPAN></FONT></FONT><SPAN style="COLOR: #008080"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">create</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">table</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;GRADE&nbsp;(&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">char</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">32</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #808080">not</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;student_id&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">char</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">32</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #808080">not</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;SUBJECT&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">varchar</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #800000">10</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">),&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;SCORE&nbsp;</SPAN><SPAN style="FONT-WEIGHT: bold; COLOR: #000000">float</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">,&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">primary</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">key</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;(ID),<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">foreign</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">key</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;(student_id)&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>);</FONT></SPAN></DIV><BR><FONT face=Arial size=2>Hibernate映射文件:<BR></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;?</SPAN><SPAN style="COLOR: #ff00ff">xml&nbsp;version="1.0"</SPAN><SPAN style="COLOR: #0000ff">?&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;!</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #ff00ff">DOCTYPE&nbsp;hibernate-mapping&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;PUBLIC&nbsp;"-//Hibernate/Hibernate&nbsp;Mapping&nbsp;DTD//EN"&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">hibernate-mapping</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">class&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="Student"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;table</SPAN><SPAN style="COLOR: #0000ff">="STUDENT"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">id&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="id"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="string"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;unsaved-value</SPAN><SPAN style="COLOR: #0000ff">="null"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">column&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="ID"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;sql-type</SPAN><SPAN style="COLOR: #0000ff">="char(32)"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">generator&nbsp;</SPAN><SPAN style="COLOR: #ff0000">class</SPAN><SPAN style="COLOR: #0000ff">="uuid.hex"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">id</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="name"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="string"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;not-null</SPAN><SPAN style="COLOR: #0000ff">="true"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">column&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="NAME"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;length</SPAN><SPAN style="COLOR: #0000ff">="16"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;not-null</SPAN><SPAN style="COLOR: #0000ff">="true"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">property</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="sex"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="char"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;column</SPAN><SPAN style="COLOR: #0000ff">="SEX"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="age"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="int"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;column</SPAN><SPAN style="COLOR: #0000ff">="AGE"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><FONT color=#ff0000><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">component&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="grade"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;class</SPAN><SPAN style="COLOR: #0000ff">="Grade"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT></FONT><FONT color=#ff0000><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="subject"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="string"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;column</SPAN><SPAN style="COLOR: #0000ff">="SUBJECT"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;not-null</SPAN><SPAN style="COLOR: #0000ff">="true"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT></FONT><FONT color=#ff0000><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="score"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="float"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;column</SPAN><SPAN style="COLOR: #0000ff">="SCORE"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;not-null</SPAN><SPAN style="COLOR: #0000ff">="true"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN></FONT></FONT></FONT><FONT color=#ff0000><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">component</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"><FONT color=#ff0000>&nbsp;<BR></FONT><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">class</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">hibernate-mapping</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></FONT></FONT></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/25115.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-22 18:46 <a href="http://www.blogjava.net/Johncn/archive/2005/12/22/25115.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE常用傻瓜问题1000问[转]</title><link>http://www.blogjava.net/Johncn/archive/2005/12/16/24224.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Fri, 16 Dec 2005 07:23:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/16/24224.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/24224.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/16/24224.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/24224.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/24224.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 作者：&nbsp;&nbsp;CCBZZP&nbsp;&nbsp; (原文)&nbsp;1. Oracle安装完成后的初始口令? &nbsp; &nbsp;　internal/oracle 　　sys/change_on_install 　　system/manager 　　scott/tiger 　　sysman/oem_temp 2. ORACLE9IAS WEB CACHE的初始默认...&nbsp;&nbsp;<a href='http://www.blogjava.net/Johncn/archive/2005/12/16/24224.html'>阅读全文</a><img src ="http://www.blogjava.net/Johncn/aggbug/24224.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-16 15:23 <a href="http://www.blogjava.net/Johncn/archive/2005/12/16/24224.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[发掘Jakarta Commons] 使用LRUMap </title><link>http://www.blogjava.net/Johncn/archive/2005/12/15/24088.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Thu, 15 Dec 2005 11:59:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/15/24088.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/24088.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/15/24088.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/24088.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/24088.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>LRUMap(<STRONG>L</STRONG>east <STRONG>R</STRONG>ecently <STRONG>U</STRONG>sed <STRONG>C</STRONG>ache)可用来保存最近使用的几条记录,例如:保存Blog中的最近10条留言.大多数情况用作缓存(如:<STRONG>EHCache</STRONG>)的一种策略.具体使用方法如下:<BR></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">import</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;java.util.Map;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.collections.map.LRUMap;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cache&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;LRUMap(&nbsp;</SPAN><SPAN style="COLOR: #000000">5</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;Populate&nbsp;the&nbsp;cache&nbsp;with&nbsp;5&nbsp;stock&nbsp;prices</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">MSFT</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">0.03</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">TSC</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">0.001</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">LU</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">23.30</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">CSCO</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">242.20</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">P</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">10.23</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;Now&nbsp;use&nbsp;some&nbsp;of&nbsp;the&nbsp;entries&nbsp;in&nbsp;the&nbsp;cache</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">Float&nbsp;cscoPrice&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">CSCO</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Float&nbsp;msPrice&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">MSFT</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Float&nbsp;tscPrice&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">TSC</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Float&nbsp;luPrice&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">LU</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Float&nbsp;pPrice&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">P</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Float&nbsp;msPrice2&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Float)&nbsp;cache.get(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">MSFT</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;Add&nbsp;another&nbsp;price&nbsp;to&nbsp;the&nbsp;Map,&nbsp;this&nbsp;should&nbsp;kick&nbsp;out&nbsp;the&nbsp;LRU&nbsp;item.</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">cache.put(&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">AA</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Float(&nbsp;</SPAN><SPAN style="COLOR: #000000">203.20</SPAN><SPAN style="COLOR: #000000">&nbsp;)&nbsp;);</SPAN></FONT></FONT></DIV><FONT face=Arial size=2>此时,缓存中的元素为:<BR>[CSCO]<BR>[MSFT]<BR>[TSC]<BR>[LU]<BR>[P]<BR>[AA]<BR>由于LRU最近没有被访问,所以当AA加入时,由于超过了缓存的最大容量(5),所以被剔除了缓存.<BR>
<HR>
<BR></FONT>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">参考资料:<BR>&lt;&lt;</SPAN><SPAN style="COLOR: #000000"><STRONG>Jakarta&nbsp;Commons&nbsp;Cookbook</STRONG></SPAN><SPAN style="COLOR: #000000">&gt;&gt;</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR>By&nbsp;Timothy&nbsp;M.&nbsp;O</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">Brien&nbsp;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;<BR>Publisher&nbsp;:&nbsp;O</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">Reilly&nbsp;</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">Pub&nbsp;Date&nbsp;:&nbsp;November&nbsp;</SPAN><SPAN style="COLOR: #000000">2004</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">&nbsp;<BR>ISBN&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">596</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">00706</SPAN><SPAN style="COLOR: #000000">-</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">X&nbsp;<BR>Pages&nbsp;:&nbsp;</SPAN><SPAN style="COLOR: #000000">400</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>&nbsp;<BR></FONT></SPAN></DIV><img src ="http://www.blogjava.net/Johncn/aggbug/24088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-15 19:59 <a href="http://www.blogjava.net/Johncn/archive/2005/12/15/24088.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SQL Server各种日期计算方法[转]</title><link>http://www.blogjava.net/Johncn/archive/2005/12/08/22963.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Thu, 08 Dec 2005 04:40:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/08/22963.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/22963.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/08/22963.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/22963.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/22963.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>(</FONT><A href="https://dream4ever.org/showthread.php?t=29463&amp;page=1"><FONT face=Arial size=2>原文</FONT></A><FONT face=Arial size=2>)<BR>
<HR>
<BR>　　通常，你需要获得当前日期和计算一些其他的日期，例如，你的程序可能需要判断一个月的第一天或者最后一天。你们大部分人大概都知道怎样把日期进行分割（年、月、日等），然后仅仅用分割出来的年、月、日等放在几个函数中计算出自己所需要的日期！在这篇文 章里，我将告诉你如何使用DATEADD和DATEDIFF函数来计算出在你的程序中可能你要用到的一些不同日期。 <BR><BR>　　在使用本文中的例子之前，你必须注意以下的问题。大部分可能不是所有例子在不同的机器上执行的结果可能不一样，这完全由哪一天是一个星期的第一天这个设置决定。第一天（DATEFIRST）设定决定了你的系统使用哪一天作为一周的第一天。所有以下的例 子都是以星期天作为一周的第一天来建立，也就是第一天设置为7。假如你的第一天设置不一样，你可能需要调整这些例子，使它和不同的第一天设置相符合。你可以通过@@DATEFIRST函数来检查第一天设置。 <BR>　　<BR>　　为了理解这些例子，我们先复习一下DATEDIFF和DATEADD函数。DATEDIFF函数计算两个日期之间的小时、天、周、月、年等时间间隔总数。DATEADD函数计算一个日期通过给时间间隔加减来获得一个新的日期。要了解更多的DATEDI FF和DATEADD函数以及时间间隔可以阅读微软联机帮助。 <BR>　　<BR>　　使用DATEDIFF和DATEADD函数来计算日期，和本来从当前日期转换到你需要的日期的考虑方法有点不同。你必须从时间间隔这个方面来考虑。比如，从当前日期到你要得到的日期之间有多少时间间隔，或者，从今天到某一天（比如1900-1-1）之间有多少时间间隔，等等。理解怎样着眼于时间间隔有助于你轻松的理解我的不同的日期计算例子。 <BR>　　<BR>　　<FONT color=red><B>一个月的第一天</B></FONT> <BR>　　<BR>　　第一个例子，我将告诉你如何从当前日期去这个月的最后一天。请注意：这个例子以及这篇文章中的其他例子都将只使用DATEDIFF和DATEADD函数来计算我们想要的日期。每一个例子都将通过计算但前的时间间隔，然后进行加减来得到想要计算的日期。 <BR>　　<BR>　　这是计算一个月第一天的SQL 脚本： <BR>　　SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) <BR>　　<BR>　　我们把这个语句分开来看看它是如何工作的。最核心的函数是getdate()，大部分人都知道这个是返回当前的日期和时间的函数。下一个执行的函数DATEDIFF(mm,0,getdate())是计算当前日期和“1900-01-01 00:00:00.000”这个日期之间的月数。记住：时期和时间变量和毫秒一样是从“1900-01-01 00:00:00.000”开始计算的。这就是为什么你可以在DATEDIFF函数中指定第一个时间表达式为“0”。下一个函数是DATEADD，增加当前日期到“1900-01-01”的月数。通过增加预定义的日期“1900-01-01”和当前日期的月数，我们可以获得这个月的第一天。另外，计算出来的日期的时间部分将会是“00:00:00.000”。 <BR>　　<BR>　　这个计算的技巧是先计算当前日期到“1900-01-01”的时间间隔数，然后把它加到“1900-01-01”上来获得特殊的日期，这个技巧可以用来计算很多不同的日期。下一个例子也是用这个技巧从当前日期来产生不同的日期。<BR>本周的星期一 <BR>　　<BR>　　这里我是用周(wk)的时间间隔来计算哪一天是本周的星期一。 <BR>　　<BR>　　SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0) <BR>　　<BR>　　<B><FONT color=red>一年的第一天</FONT></B> <BR>　　<BR>　　现在用年(yy)的时间间隔来显示这一年的第一天。 <BR>　　<BR>　　SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) <BR>　　<BR>　　<FONT color=red><B>季度的第一天</B> </FONT><BR>　　<BR>　　假如你要计算这个季度的第一天，这个例子告诉你该如何做。 <BR>　　<BR>　　SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0) <BR>　　<BR>　　<FONT color=red><B>当天的半夜</B></FONT> <BR>　　<BR>　　曾经需要通过getdate()函数为了返回时间值截掉时间部分，就会考虑到当前日期是不是在半夜。假如这样，这个例子使用DATEDIFF和DATEADD函数来获得半夜的时间点。 <BR>　　<BR>　　SELECT DATEADD(dd, DATEDIFF(dd,0,getdate()), 0) <BR>　　<BR>　　深入DATEDIFF和DATEADD函数计算 <BR>　　<BR>　　你可以明白，通过使用简单的DATEDIFF和DATEADD函数计算，你可以发现很多不同的可能有意义的日期。 <BR>　　<BR>　　目前为止的所有例子只是仅仅计算当前的时间和“1900-01-01”之间的时间间隔数量，然后把它加到“1900-01-01”的时间间隔上来计算出日期。假定你修改时间间隔的数量，或者使用不同的时间间隔来调用DATEADD函数，或者减去时间间隔而不是增加，那么通过这些小的调整你可以发现和多不同的日期。 <BR>　　<BR>　　这里有四个例子使用另外一个DATEADD函数来计算最后一天来分别替换DATEADD函数前后两个时间间隔。 <BR><B><FONT color=red>上个月的最后一天</FONT> </B><BR>　　<BR>　　这是一个计算上个月最后一天的例子。它通过从一个月的最后一天这个例子上减去3毫秒来获得。有一点要记住，在Sql Server中时间是精确到3毫秒。这就是为什么我需要减去3毫秒来获得我要的日期和时间。 <BR>　　<BR>　　SELECT dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)) <BR>　　<BR>　　计算出来的日期的时间部分包含了一个Sql Server可以记录的一天的最后时刻(“23:59:59:997”)的时间。 <BR>　　<BR>　　<B><FONT color=red>去年的最后一天</FONT></B> <BR>　　<BR>　　连接上面的例子，为了要得到去年的最后一天，你需要在今年的第一天上减去3毫秒。 <BR>　　<BR>　　SELECT dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)) <BR>　　<BR>　　<FONT color=red><B>本月的最后一天</B></FONT> <BR>　　<BR>　　现在，为了获得本月的最后一天，我需要稍微修改一下获得上个月的最后一天的语句。修改需要给用DATEDIFF比较当前日期和“1900-01-01”返回的时间间隔上加1。通过加1个月，我计算出下个月的第一天，然后减去3毫秒，这样就计算出了这个月的最后一天。这是计算本月最后一天的SQL脚本。 <BR>　　<BR>　　SELECT dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate())+1, 0)) <BR>　　<BR>　　<FONT color=red><B>本年的最后一天</B> </FONT>　　<BR>　　你现在应该掌握这个的做法，这是计算本年最后一天脚本 <BR>　　<BR>　　SELECT dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate())+1, 0))。 <BR>　　<BR>　　<FONT color=red><B>本月的第一个星期一</B></FONT> <BR>　　<BR>　　好了，现在是最后一个例子。这里我要计算这个月的第一个星期一。这是计算的脚本。 <BR>　　<BR>　　select DATEADD(wk, DATEDIFF(wk,0, <BR>　　dateadd(dd,6-datepart(day,getdate()),getdate()) <BR>　　), 0) <BR>　　<BR>　　在这个例子里，我使用了“本周的星期一”的脚本，并作了一点点修改。修改的部分是把原来脚本中“getdate()”部分替换成计算本月的第6天，在计算中用本月的第6天来替换当前日期使得计算可以获得这个月的第一个星期一。 <BR>　　<BR>　　总结 <BR>　　<BR>　　我希望这些例子可以在你用DATEADD和DATEDIFF函数计算日期时给你一点启发。通过使用这个计算日期的时间间隔的数学方法，我发现为了显示两个日期之间间隔的有用历法是有价值的。注意，这只是计算出这些日期的一种方法。要牢记，还有很多方法 可以得到相同的计算结果。假如你有其他的方法，那很不错，要是你没有，我希望这些例子可以给你一些启发，当你要用DATEADD和DATEDIFF函数计算你程序可能要用到的日期时。 <BR>附录，其他日期处理方法 <BR>　　<BR>　　1)<FONT color=red>去掉时分秒</FONT> <BR>　　declare @ datetime <BR>　　set @ = getdate() --'2003-7-1 10:00:00' <BR>　　SELECT @,DATEADD(day, DATEDIFF(day,0,@), 0) <BR>　　<BR>　　2）<FONT color=red>显示星期几</FONT> <BR>　　select datename(weekday,getdate()) <BR>　　<BR>　　3）如何<FONT color=red>取得某个月的天数</FONT> <BR>　　declare @m int <BR>　　set @m=2 --月份 <BR>　　select datediff(day,'2003-'+cast(@m as varchar)+'-15' ,'2003-'+cast(@m+1 as varchar)+'-15') <BR>　　另外，取得本月天数 <BR>　　select datediff(day,cast(month(GetDate()) as varchar)+'-'+cast(month(GetDate()) as varchar)+'-15' ,cast(month(GetDate()) as varchar)+'-'+cast(month(GetDate())+1 as varchar)+'-15') <BR>　　或者使用计算本月的最后一天的脚本，然后用DAY函数区最后一天 <BR>　　SELECT Day(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate())+1, 0))) <BR>　　<BR>　　4）<FONT color=red>判断是否闰年</FONT>： <BR>　　SELECT case day(dateadd(mm, 2, dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)))) when 28 then '平年' else '闰年' end <BR>　　或者 <BR>　　select case datediff(day,datename(year,getdate())+'-02-01',dateadd(mm,1,datename(year,getdate())+'-02-01')) <BR>　　when 28 then '平年' else '闰年' end <BR>　　<BR>　　5）<FONT color=red>一个季度多少天</FONT> <BR>　　declare @m tinyint,@time smalldatetime <BR>　　select @m=month(getdate()) <BR>　　select @m=case when @m between 1 and 3 then 1 <BR>　　when @m between 4 and 6 then 4 <BR>　　when @m between 7 and 9 then 7 <BR>　　else 10 end <BR>　　select @time=datename(year,getdate())+'-'+convert(varchar(10),@m)+'-01' <BR>　　select datediff(day,@time,dateadd(mm,3,@time))</FONT></P><!-- / message --><!-- edit note --><img src ="http://www.blogjava.net/Johncn/aggbug/22963.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-08 12:40 <a href="http://www.blogjava.net/Johncn/archive/2005/12/08/22963.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自定义Windows服务</title><link>http://www.blogjava.net/Johncn/archive/2005/12/07/22838.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Wed, 07 Dec 2005 03:58:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/07/22838.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/22838.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/07/22838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/22838.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/22838.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">使用工具</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><A href="http://http://postboy.myetang.com/files/srvany.exe">instsrv.exe</A></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">和</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><A href="http://http://postboy.myetang.com/files/instsrv.exe">Srvany.exe</A></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">可将应用程序注册为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">Windows</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">服务</SPAN></FONT></FONT><SPAN lang=EN-US style="FONT-FAMILY: Arial"><FONT size=2>.<BR>　　<STRONG>instsrv</STRONG>: 这个工具是把win32程序变成系统服务。<BR>　　基本用法：<STRONG>instsrv [服务名] [应用程序绝对路径]</STRONG> (增加服务)<BR><STRONG>&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; instsrv [服务名] REMOVE</STRONG>　　(删除服务)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 但是并不是所有程序都适合做系统服务的，注册成系统服务后就是无法启动的,这时就需要用到srvany.<BR><BR>　　<STRONG>srvany</STRONG>: 这个工具就是用来解决上面的工具中的问题，你注册的时候把它当作你要的服务，在用它来启动你的应用程序。<BR>　　基本用法：</FONT><FONT size=2><STRONG>instsrv [服务名] [srvany的绝对路径]<BR></STRONG><BR>具体步骤如下:<BR><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">注册服务</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">: <B style="mso-bidi-font-weight: normal">path\instsrv </B></SPAN><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">服务名</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> path\srvany.exe</SPAN></B><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">regedit</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">打开注册表</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">进入</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">服务名</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">右键</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">新建</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">项</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">填入</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> Parameters</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">5.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">打开</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Parameters</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">，右键</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">新建</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">字符串值</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> Application</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">6.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">双击</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Application </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">填入</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">应用程序的绝对路径</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">如</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">:</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">D:\workspace\meip26\meip.exe</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">7.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">右键</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">新建</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">-</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">字符串值</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">AppDirectory </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">8.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">双击</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">AppDirectory </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">填入</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">应用程序的工作目录</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial">如</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">:</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">D:\workspace\meip26\</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore"><FONT face=Arial><FONT size=2>9.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-bidi-font-family: Arial"><FONT face=Arial size=2>启动服务。<BR></FONT></SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p><BR><FONT size=2>在Parameters里还可以添加很多键值：<BR>　　AppDirectory 工作目录<BR>　　AppParameters 你的应用程序的参数。<BR>　　AppEnvironment 运行环境变量。<BR></FONT></P><FONT size=2>
<HR>
</FONT></o:p></SPAN>
<P><FONT face=Arial size=2></FONT></P><img src ="http://www.blogjava.net/Johncn/aggbug/22838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-07 11:58 <a href="http://www.blogjava.net/Johncn/archive/2005/12/07/22838.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在DOS下恢复回收站中的文件[转]</title><link>http://www.blogjava.net/Johncn/archive/2005/12/06/22771.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Tue, 06 Dec 2005 12:49:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/06/22771.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/22771.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/06/22771.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/22771.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/22771.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>　　在Windows无法启动的时候，我们如何恢复回收站中的文件呢？如果当时删除时并不知道删除了些什么文件，能否恢复系统运行呢？回答是肯定的，就是用经典的 DOS 命令来实现。 </FONT></P>
<P><FONT face=Arial size=2>　　比如在双启动的系统里，在Windows 98的环境下误删除了NT的系统文件，导致NT和Windows 98都无法启动。 </FONT></P>
<P><FONT face=Arial size=2>　　下面介绍一种办法可以帮你解决这个问题。 首先进入到DOS模式(如果WINDOWS不能正常启动的话，用带启动文件的软盘启动)，进入到C: RECYCLED目录，这是一个隐藏目录，如果你要恢复的文件原来在D盘，相应的目录是D:RECYCLED。用dir/a命令可以列出一堆DC开头的隐藏文件（DC1.txt, DC2.com...），这些就是被你已经删除了的文件。 </FONT></P>
<P><FONT face=Arial size=2>　　但是由于Windows在把文件移至回收站的时候，把文件名给改了，所以还需要找回原来的文件名。原来的文件名可以从RECYCLED目录下的INFO2 文件中找的(用EDIT INFO2 )。INFO2 是一个二进制文件，每一个被删除的文件在 INFO2 文件中有一段记录（800字节），其中可以找到文件名，其他的信息都不是ASCII字符，那些乱码就不必管它了。 按找到的文件名用 COPY 命令拷到目标位置即可，如： COPY DC2.EXE C:WINDOWSCOMMANDDELTREE.EXE。 </FONT></P>
<P><FONT face=Arial size=2>　　文件名是按顺序排列的，第一个文件名就是DC1.* 文件的原来的文件名，后缀名保持不变。如果被删除的是目录的话，在RECYCLED下就有一个叫DC????的目录，用同样的方法可以找回原来的目录名。 </FONT></P>
<P><FONT face=Arial size=2>　　要做好这些工作，你必须保证有一张可以启动的软盘，除有io.sys、msdos.sys 和 command.com 外，最好里面有 edit.com 、attrib.exe文件，相信懂一点DOS基础的人都知道这是拿来做什么用的。同时也敬告熟悉 Windows 95/98/ME/2000/NT的用户，把常用的DOS命令也学一学，Windows用起来的确舒服，但出了问题有时还得用DOS方法来解决。</FONT></P><img src ="http://www.blogjava.net/Johncn/aggbug/22771.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-06 20:49 <a href="http://www.blogjava.net/Johncn/archive/2005/12/06/22771.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>将Java程序作成exe文件的几种方法[转]</title><link>http://www.blogjava.net/Johncn/archive/2005/12/06/22769.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Tue, 06 Dec 2005 12:41:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/06/22769.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/22769.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/06/22769.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/22769.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/22769.html</trackback:ping><description><![CDATA[<TABLE class=zhi14 height=38 cellSpacing=0 cellPadding=0 width=648 align=center border=0>
<TBODY>
<TR>
<TD width=648 height=20><FONT face=Arial size=2>&nbsp;</FONT></TD></TR>
<TR>
<TD style="WORD-BREAK: break-all" vAlign=top width=648 height=18><BR><FONT face=Arial size=2>　　<B>一、exe4j</B><BR><BR>说明：exe4j可以将Jar文件制作成exe文件，但需jre支持，也可将Jar文件放在外面。<BR><BR>软件性质：共享软件<BR><BR>下载地址：http://www.ej-technologies.com/products/exe4j/overview.html<BR><BR><B>二、JBuilder</B><BR><BR>说明：新版本的JBuilder可以直接把工程制作成各系统的可执行文件，包括Windows系统。<BR><BR>软件性质：商业软件<BR><BR>下载地址：略。我是从eMule下载的。<BR><BR><B>三、NativeJ</B><BR><BR>说明：与exe4j功能类似。<BR><BR>软件性质：共享软件<BR><BR>下载地址：http://www.dobysoft.com/products/nativej/download.html<BR><BR><B>四、Excelsior JET</B><BR><BR>说明：可以直接将Java类文件制作成exe文件，除AWT和Swing及第三方图形接口外可不需jre支持（Java5.0不行）。<BR><BR>软件性质：共享软件<BR><BR>下载地址：http://excelsior-usa.com/home.html<BR><BR><B>五、jshrink</B><BR><BR>说明：可将Jar文件打包进exe文件。同时具有混淆功能（这才是它的主要功能）。<BR><BR>软件性质：共享软件<BR><BR>下载地址：http://www.e-t.com/jshrink.html<BR><BR><B>六、InstallAnywhere</B><BR><BR>说明：打包工具，对Java打包最好用。可打包成各操作系统运行包。包括Windows系统。<BR><BR>软件性质：商业软件。<BR><BR>下载地址：http://www.zerog.com/<BR><BR><B>七、InstallShieldX</B><BR><BR>说明：与InstallAnywhere类似，但比InstallAnywhere功能强大。相对的，比较复杂，不易上手，我现在还没学会。<BR></FONT></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/Johncn/aggbug/22769.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-06 20:41 <a href="http://www.blogjava.net/Johncn/archive/2005/12/06/22769.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>让Java程序带着jre一起上路[转]</title><link>http://www.blogjava.net/Johncn/archive/2005/12/06/22768.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Tue, 06 Dec 2005 12:40:00 GMT</pubDate><guid>http://www.blogjava.net/Johncn/archive/2005/12/06/22768.html</guid><wfw:comment>http://www.blogjava.net/Johncn/comments/22768.html</wfw:comment><comments>http://www.blogjava.net/Johncn/archive/2005/12/06/22768.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Johncn/comments/commentRss/22768.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Johncn/services/trackbacks/22768.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>　　用Java开发程序，发布时总要考虑的问题就是怎么在使用者的机器上装好JRE。要考虑的问题很多：使用者有没有能力独自安装JRE，使用者已有的JRE和我们需要的版本是不是一致，会不会出现版本问题，等等。<BR><BR>使用.NET要考虑的问题就少些。现在.NET CLR似乎已经很普及了，看好多D版的Win XP都会自己安装最新的.NET CLR，而且似乎它的安装界面也比JRE友好些。彻底解决安装JRE的问题的方案，就是让我们的应用程序自己背着JRE！这样，我们的程序就像传统的Win32应用程序一样，双击就可以执行，不用管所在的机器上是否有JRE，是什么版本的JRE，无论怎样，我有我自己的！要做到这一点，其实非常容易。<BR><BR>王森在他的《Java深度历险》（强力推荐这本书，内容少而精）的第一章就解释了JDK，JRE，JVM之间的关系。解释了我们执行java.exe时发生的事情。其中提到，java.exe依照一套逻辑来寻找可以用的JRE，首先查找自己所在的目录下有没有JRE（据王森讲这样说不确切，我没有JDK全部的源代码，在此无从考证）；其次查找自己的父目录下有没有JRE；最后才是查询Windows的注册表。<BR><BR>通常我们在安装好了JRE的机器上的任何一个目录下都可以执行java.exe。因为它在安装时被复制到了windows的system32目录下，而后者无论如何都会在path环境变量中。这个java.exe最终必然会访问注册表来确定真正的JRE的所在地。若我们要求每一个应用程序都自带JRE，必然不能走这条路。但，逻辑的第二条讲，java.exe会在它的父目录下查找JRE，解决方案就在这一条中。<BR><BR>假设我们的应用程序打好了包，叫做MyApp.jar，放在MyApp的目录下。我们在MyApp目录下，可以执行java –jar MyApp.jar来运行我们的程序。我们安装的是JRE 1.5，在C:\Program Files\Java\jre1.5.0下。现在，我们只需要简单的将jre1.5.0目录搬到MyApp目录下，顺便改个容易写的名字比如叫jre。现在，我们的应用程序就象这样：<BR><BR>MyApp<BR>MyApp.jar<BR>Jre<BR>Jre1.5.0目录下的全部内容<BR><BR>Java.exe就在jre目录下的bin目录中。根据第二条逻辑，java.exe会在它的父目录中查找jre，实验证实，它会查找lib目录，而lib就在jre目录下。因此，这样java.exe就会确定jre的所在然后正常执行java程序，不会去管我们是否安装了JRE，注册表中是否有注册项这些杂事了。<BR><BR>试一下，在命令行下进入MyApp的目录下，假设它在C盘，将path指向MyApp下的JRE：<BR>set path=c:\MyApp\jre\bin<BR><BR>然后运行：<BR>java –verbose –jar MyApp.jar<BR><BR>加上verbose参数以确定我们确实用了这一套被搬出了家的JRE。<BR><BR>程序可以运行，并且在命令行输出的前几行，可以看到：<BR><BR>[Opened C:\MyApp\jre\lib\rt.jar]<BR>[Opened C:\MyApp\jre\lib\jsse.jar]<BR>[Opened C:\MyApp\jre\lib\jce.jar]<BR>[Opened C:\MyApp\jre\lib\charsets.jar]<BR><BR>因此程序读取的确实是它的私有的JRE。<BR><BR>至此，我们似乎完成了任务。但是现在我们的私有JRE仍不完美，缺点是太大。JRE 1.5有接近70MB，作为我们的私有的JRE，好多内容都是可以抛弃的。Jre目录下的license都可以不要，bin下的执行文件只需要保留java.exe或者javaw.exe，lib下只要保留rt，jsse，jce，charsets几个库就可以了。除了i386和zi两个子目录外，其余的子目录都可以不要。Zi下只需要保留自己地区的子目录和其下的一些文件就可以。Lib下除了库之外的属性文件等等都要保留。这样清理一番，JRE仍然有接近50MB。还可以继续清理几个库文件里面不需要的内容，这需要仔细的整理，会很费功夫。最好能写出一个自动工具帮助我们整理它们。从Sun公司上下到的JMF里面附带的用Java写的媒体播放器就自带了JRE，只有几个MB。<BR><BR>清理过后需要运行几遍我们的应用程序，以确保我们的JRE不缺少东西。<BR><BR>如果我们希望能有一个程序直接启动我们的应用程序，那就还要费些功夫。最简单的方法是弄出一个快捷方式来，但是快捷方式的路径不能是相对的，不方便我们安装。我想到的方案就是用Win32程序包装一下。在VS.NET下写一个Win32小程序：<BR><BR>int PASCAL WinMain( HINSTANCE hInstance,<BR>HINSTANCE hPrevInstance,<BR>LPSTR lpszCmdLine,<BR>int nCmdShow ){　　STARTUPINFO si;<BR>PROCESS_INFORMATION pi;<BR>ZeroMemory( &amp;si, sizeof(si) );<BR>si.cb = sizeof(si);<BR>ZeroMemory( &amp;pi, sizeof(pi) );<BR>// Start the child process.<BR>if( !CreateProcess( "jre\\bin\\javaw.exe",//执行的程序名<BR>"jre\\bin\\javaw.exe -jar MyApp.jar", // 带参数的执行程序<BR>NULL,<BR>// Process handle not inheritable.<BR>NULL,<BR>// Thread handle not inheritable.<BR>FALSE,<BR>// Set handle inheritance to FALSE.<BR>0,<BR>// No creation flags.<BR>NULL,<BR>// Use parent's environment block.<BR>NULL,<BR>// Use parent's starting directory.<BR>&amp;si,<BR>// Pointer to STARTUPINFO structure.<BR>&amp;pi )<BR>// Pointer to PROCESS_INFORMATION structure.　　)<BR>{　　　　　　ErrorExit( "CreateProcess failed." );<BR>}　　 // Wait until child process exits.　　WaitForSingleObject( pi.hProcess, INFINITE );<BR>// Close process and thread handles.<BR>CloseHandle( pi.hProcess );<BR>CloseHandle( pi.hThread );}<BR><BR>基本上是按照MSDN文档中的例子照搬的。将它编译成一个EXE文件，我们的任务才全部完成。双击这个EXE文件，我们的程序启动了，看起来和传统的Win32程序没有两样，JRE完全被隐藏在底层。<BR><BR>P.S. 使用了这个方案后，我用Wise Installation System制作安装程序，发现一个非常奇怪的问题，安装结束后，安装程序似乎非要运行一个叫做GLJ什么什么，后缀是TMP的程序，还需要JVM，结果就报错JVM.DLL找不到。安装总是不成功。我已经禁掉了OCX / DLL / EXE自注册和卸载支持，为什么还不对？有谁知道是为什么吗？ </FONT><img src ="http://www.blogjava.net/Johncn/aggbug/22768.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Johncn/" target="_blank">ZhuJun</a> 2005-12-06 20:40 <a href="http://www.blogjava.net/Johncn/archive/2005/12/06/22768.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>