﻿<?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-甜咖啡</title><link>http://www.blogjava.net/weishuangshuang/</link><description>我的IT空间</description><language>zh-cn</language><lastBuildDate>Tue, 28 Apr 2026 14:30:36 GMT</lastBuildDate><pubDate>Tue, 28 Apr 2026 14:30:36 GMT</pubDate><ttl>60</ttl><item><title>Java遍历Map和遍历Set</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397347.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 03 Apr 2013 04:12:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397347.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/397347.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397347.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/397347.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/397347.html</trackback:ping><description><![CDATA[<div id="cnblogs_post_body"> <p><span style="font-family: 'Courier New'; " face="Courier New" color="#000000">Java遍历Map<br />public static void main(String[] args) {</span></p><p><span style="font-family: 'Courier New'; " face="Courier New" color="#000000">&nbsp;&nbsp;Map&lt;String, String&gt; map = new  HashMap&lt;String, String&gt;();<br />&nbsp;&nbsp;map.put("1", "value1");<br />&nbsp;&nbsp;map.put("2",  "value2");<br />&nbsp;&nbsp;map.put("3",  "value3");<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;//第一种：普遍使用，二次取值<br />&nbsp;&nbsp;System.out.println("通过Map.keySet遍历key和value：");<br />&nbsp;&nbsp;for  (String key : map.keySet()) {<br />&nbsp;&nbsp;&nbsp;System.out.println("key= "+ key + " and  value= " +  map.get(key));<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;//第二种<br />&nbsp;&nbsp;System.out.println("通过Map.entrySet使用iterator遍历key和value：");<br />&nbsp;&nbsp;Iterator&lt;Map.Entry&lt;String,  String&gt;&gt; it = map.entrySet().iterator();<br />&nbsp;&nbsp;while (it.hasNext())  {<br />&nbsp;&nbsp;&nbsp;Map.Entry&lt;String, String&gt; entry =  it.next();<br />&nbsp;&nbsp;&nbsp;System.out.println("key= " + entry.getKey() + " and value= " +  entry.getValue());<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;//第三种：推荐，尤其是容量大时<br />&nbsp;&nbsp;System.out.println("通过Map.entrySet遍历key和value");<br />&nbsp;&nbsp;for  (Map.Entry&lt;String, String&gt; entry : map.entrySet())  {<br />&nbsp;&nbsp;&nbsp;System.out.println("key= " + entry.getKey() + " and value= " +  entry.getValue());<br />&nbsp;&nbsp;}</span></p> <p><span face="Courier New" color="#000000"><font face="Courier New">&nbsp;&nbsp;//第四种</font><br /><font face="Courier New">&nbsp;&nbsp;System.out.println("通过Map.values()遍历所有的value，但不能遍历key");</font><br /><font face="Courier New">&nbsp;&nbsp;for  (String v : map.values()) {</font><br /><font face="Courier New">&nbsp;&nbsp;&nbsp;System.out.println("value= " +  v);</font><br /><font face="Courier New">&nbsp;&nbsp;}</font><br /><font face="Courier New">&nbsp;}</font><br /><br /><font face="Courier New">Java遍历Set</font><br /><div>对 set 的遍历 &nbsp;</div><div></div><div>1.迭代遍历： &nbsp;</div><div>Set&lt;String&gt; set = new HashSet&lt;String&gt;(); &nbsp;</div><div>Iterator&lt;String&gt; it = set.iterator(); &nbsp;</div><div>while (it.hasNext()) { &nbsp;</div><div>&nbsp; String str = it.next(); &nbsp;</div><div>&nbsp; System.out.println(str); &nbsp;</div><div>} &nbsp;</div><div>&nbsp;&nbsp;</div><div>2.for循环遍历： &nbsp;</div><div>for (String str : set) { &nbsp;</div><div>&nbsp; &nbsp; &nbsp; System.out.println(str); &nbsp;</div><div>} &nbsp;</div><div>&nbsp;&nbsp;</div><div>&nbsp;&nbsp;</div><div>优点还体现在泛型 假如 set中存放的是Object &nbsp;</div><div>&nbsp;&nbsp;</div><div>Set&lt;Object&gt; set = new HashSet&lt;Object&gt;(); &nbsp;</div><div>for循环遍历： &nbsp;</div><div>for (Object obj: set) { &nbsp;</div><div>&nbsp; &nbsp; &nbsp; if(obj instanceof Integer){ &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int aa= (Integer)obj; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}else if(obj instanceof String){ &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String aa = (String)obj &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ........ &nbsp;</div><div>} &nbsp;</div></span></p></div> <div id="MySignature">当一个人找不到出路的时候，最好的办法就是将当前能做好的事情做到极致，做到无人能及。</div><div></div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/397347.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-04-03 12:12 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397347.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE同一个数据库导入时，数据还保存在原来的表空间上 </title><link>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397346.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 03 Apr 2013 04:07:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397346.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/397346.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/397346.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/397346.html</trackback:ping><description><![CDATA[<p>今天在研究了一下关于ORACLE的导入导出的功能，周五快要下班的时候给同事新建一个表空间，将同一个数据库中的某个用户下的表导入新的表空间上，建好表空间和用户后，直接用&nbsp;exp&nbsp;,imp&nbsp;来导入数据到新的表空间，查是发现后来导入的数据还在原来的表空间上，（周五那天的我是用工具编辑DMP文件，修改里的表空间名后导入的），后来想起来了eygle的书上写了关于这个的问题，于是今天就来试验了一下。</p> <p><strong>第一种：修改用户的一些权限。</strong></p> <p>首先使用sytem帐户登陆</p> <p>--<strong>创建新表空间的用户</strong></p> <p>SQL&gt;&nbsp;create&nbsp;user&nbsp;pangzi&nbsp;identified&nbsp;by&nbsp;pangzi&nbsp;default&nbsp;tablespace&nbsp;pangzi&nbsp;temporary&nbsp;tablespace&nbsp;temp;</p> <p>用户已创建。</p> <p>--<strong>授给新用户一般的权限</strong></p> <p>SQL&gt;&nbsp;grant&nbsp;export&nbsp;full&nbsp;database&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p> <p>SQL&gt;&nbsp;grant&nbsp;import&nbsp;full&nbsp;database&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p> <p>SQL&gt;&nbsp;grant&nbsp;connect,resource&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p> <p>SQL&gt;&nbsp;grant&nbsp;create&nbsp;procedure&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p> <p>SQL&gt;&nbsp;grant&nbsp;create&nbsp;job&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p>SQL&gt;&nbsp;grant&nbsp;create&nbsp;view&nbsp;to&nbsp;pangzi; <p>授权成功。</p> <p>SQL&gt;&nbsp;grant&nbsp;create&nbsp;synonym&nbsp;to&nbsp;pangzi;</p> <p>授权成功。</p> <p>--<strong>从这里开始将是增加的，为了使导入的数据，不放在原来的表空间上</strong></p> <p>SQL&gt;&nbsp;grant&nbsp;dba&nbsp;to&nbsp;pangzi;</p> <p>--<strong>收回用户的umlimited tablespace权限</strong></p> <p><strong></strong></p> <p>SQL&gt;&nbsp;revoke&nbsp;unlimited&nbsp;tablespace&nbsp;from&nbsp;pangzi;</p> <p>--<strong>设置新创建的用户可使用syb表空间的大小0（原数据所在的表空间为syb）</strong></p> <p>SQL&gt;&nbsp;alter&nbsp;user&nbsp;pangzi&nbsp;quota&nbsp;0&nbsp;on&nbsp;syb;</p> <p>--<strong>设置新创建的用户可使用pangzi表空间的大小不限制</strong></p> <p>&nbsp;</p> <p>SQL&gt;&nbsp;alter&nbsp;user&nbsp;pangzi&nbsp;quota&nbsp;unlimited&nbsp;on&nbsp;pangzi;</p> <p>--<strong>收回DBA权限</strong></p> <p>SQL&gt;&nbsp;revoke&nbsp;dba&nbsp;from&nbsp;pangzi;</p> <p><strong>执行导入数据</strong></p> <p>C:\Users\dyspangzi&gt;imp&nbsp;pangzi/pangzi@testdev&nbsp;file=syb.dmp&nbsp;full=y</p> <p>&nbsp;</p> <p>Import:&nbsp;Release&nbsp;10.2.0.3.0&nbsp;-&nbsp;Production&nbsp;on&nbsp;星期六&nbsp;4月&nbsp;21&nbsp;17:48:54&nbsp;2012</p> <p>&nbsp;</p> <p>Copyright&nbsp;(c)&nbsp;1982,&nbsp;2005,&nbsp;Oracle.&nbsp;&nbsp;All&nbsp;rights&nbsp;reserved.</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>连接到:&nbsp;Oracle&nbsp;Database&nbsp;10g&nbsp;Enterprise&nbsp;Edition&nbsp;Release&nbsp;10.2.0.1.0&nbsp;-&nbsp;Production</p> <p>With&nbsp;the&nbsp;Partitioning,&nbsp;OLAP&nbsp;and&nbsp;Data&nbsp;Mining&nbsp;options</p> <p>&nbsp;</p> <p>经由常规路径由&nbsp;EXPORT:V10.02.01&nbsp;创建的导出文件</p> <p>&nbsp;</p> <p>警告:&nbsp;这些对象由&nbsp;SYB&nbsp;导出,&nbsp;而不是当前用户</p> <p>&nbsp;</p> <p>已经完成&nbsp;ZHS16GBK&nbsp;字符集和&nbsp;AL16UTF16&nbsp;NCHAR&nbsp;字符集中的导入</p> <p>.&nbsp;正在将&nbsp;SYB&nbsp;的对象导入到&nbsp;PANGZI</p> <p>.&nbsp;.&nbsp;正在导入表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ALL_SALES"导入了&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;360&nbsp;行</p> <p>.&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;"COUPONS"导入了&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;行</p> <p>.&nbsp;.&nbsp;正在导入表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"CUSTOMERS"导入了&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;行</p> <p>. .中间部分内容省略，都是导入的信息</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>.&nbsp;.&nbsp;正在导入表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"REG_EXPS"导入了&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;行</p> <p>.&nbsp;.&nbsp;正在导入表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"SALARY_GRADES"导入了&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;行</p> <p>即将启用约束条件...</p> <p>成功终止导入,&nbsp;没有出现警告。</p> <p><strong>导入成功，我们看导的表已经在新的表空间中了</strong></p> <p>SQL&gt; show user<br />USER 为 "PANGZI"<br />SQL&gt; select  table_name,tablespace_name from user_tables;</p> <p>TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  TABLESPACE_NAME<br />------------------------------  ------------------------------<br />DYSPANGZI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />CUSTOMERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_TYPES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />EMPLOYEES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />SALARY_GRADES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_WITH_TIMESTAMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_TIMESTAMP_WITH_TZ&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_WITH_LOCAL_TZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />COUPONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PANGZI</p> <p>TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  TABLESPACE_NAME<br />------------------------------  ------------------------------<br />PROMOTIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />ORDER_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_CHANGES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />MORE_PRODUCTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />MORE_EMPLOYEES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />DIVISIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />JOBS&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;  PANGZI<br />EMPLOYEES2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />ALL_SALES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_PRICE_AUDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />REG_EXPS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PANGZI</p> <p>已选择22行。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>第二种：使用EXPDP和IMPDP来导入和导出 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <strong></strong>&nbsp;使用expdp来导出，首先要为一个参数来指定一个路径&#8212;&#8212;directory，expdp是在服务器端工作，导出的文件需要放在本地目录，这个参数就是保存导出文件的位置。这个可以自己创建，也可以是默认的，我自己创建了一个，名字是expdir</p> <p>SQL&gt;&nbsp;CREATE&nbsp;OR&nbsp;REPLACE&nbsp;DIRECTORY&nbsp;expdir&nbsp;AS&nbsp;'/var/backup';</p> <p>&nbsp;</p> <p>目录已创建。</p> <p>&nbsp;</p> <p>SQL&gt;&nbsp;select&nbsp;*&nbsp;from&nbsp;dba_directories;</p> <p>&nbsp;</p> <p>OWNER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DIRECTORY_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DIRECTORY_PATH</p> <p>-------------------&nbsp;&nbsp;&nbsp;-------------------------------&nbsp;&nbsp;-----------------------------------------</p> <p>SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADMIN_DIR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ade/aime_10.2_lnx_push/oracle/md/admin</p> <p>&nbsp;</p> <p>SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DATA_PUMP_DIR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/app/oracle/product/10.2.0/db_1/rdbms/log/</p> <p>&nbsp;</p> <p>SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WORK_DIR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ade/aime_10.2_lnx_push/oracle/work</p> <p>&nbsp;</p> <p>SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EXPDIR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/var/backup</p> <p>--<strong>给用户授予读写权限</strong></p> <p>&nbsp;</p> <p>&nbsp;</p> <p>SQL&gt;&nbsp;grant&nbsp;read,write&nbsp;on&nbsp;directory&nbsp;expdir&nbsp;to&nbsp;syb;</p> <p><strong>开始导出数据</strong></p> <p>[oracle@dyspangzi ~]$ expdp dumpfile=syb.dmp directory=expdir;</p> <p>Export: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012  18:06:46</p> <p>Copyright (c) 2003, 2005, Oracle.&nbsp; All rights reserved.</p> <p>Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 -  Production<br />With the Partitioning, OLAP and Data Mining options<br />Starting  "SYB"."SYS_EXPORT_SCHEMA_01":&nbsp; dumpfile=syb.dmp directory=expdir <br />Estimate in  progress using BLOCKS method...<br />Processing object type  SCHEMA_EXPORT/TABLE/TABLE_DATA<br />Total estimation using BLOCKS method: 1.375  MB<br />Processing object type  SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA<br />Processing object type  SCHEMA_EXPORT/TABLE/TABLE<br />Processing object type  SCHEMA_EXPORT/TABLE/INDEX/INDEX<br />Processing object type  SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT<br />Processing object type  SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS<br />Processing object type  SCHEMA_EXPORT/TABLE/COMMENT<br />Processing object type  SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC<br />Processing object type  SCHEMA_EXPORT/FUNCTION/FUNCTION<br />Processing object type  SCHEMA_EXPORT/PROCEDURE/PROCEDURE<br />Processing object type  SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC<br />Processing  object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION<br />Processing object type  SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE<br />Processing object type  SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY<br />Processing object type  SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT<br />Processing object type  SCHEMA_EXPORT/TABLE/TRIGGER<br />. . exported  "SYB"."DYSPANGZI"&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; 48.50 KB&nbsp;&nbsp;&nbsp;&nbsp; 659 rows<br />. .  exported "SYB"."ALL_SALES"&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; 13.68 KB&nbsp;&nbsp;&nbsp;&nbsp; 360  rows<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 中间导出信息省略</p> <p>.&nbsp; . exported "SYB"."REG_EXPS"&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; 5.437 KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1  rows<br />. . exported "SYB"."SALARY_GRADES"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.710 KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  4 rows<br />. . exported "SYB"."PRODUCT_PRICE_AUDIT"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0  KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 rows<br />Master table "SYB"."SYS_EXPORT_SCHEMA_01" successfully  loaded/unloaded<br />******************************************************************************<br />Dump  file set for SYB.SYS_EXPORT_SCHEMA_01 is:<br />&nbsp; /var/backup/syb.dmp<br />Job  "SYB"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:07:11</p> <p>&nbsp;</p> <p><strong>导出成功后查看一下刚才创建目录里边的内容</strong></p> <p>[root@dyspangzi var]# cd backup<br />[root@dyspangzi backup]# ls -l<br />总计  720<br />-rw-r--r-- 1 oracle oinstall&nbsp;&nbsp; 3472 04-21 18:07 export.log<br />-rw-r-----  1 oracle oinstall 729088 04-21 18:07 syb.dmp</p> <p>多了两个文件，一个是日志文件一个是导出的数据文件，在导入的时候需要这两个文件。下面开始导入。</p> <p>===================================================================================</p> <p><strong>出现了第一个错误</strong></p> <p>[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir  remap_tablespace=syb:pangzi</p> <p>Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012  18:45:35</p> <p>Copyright (c) 2003, 2005, Oracle.&nbsp; All rights reserved.</p> <p>Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 -  Production<br />With the Partitioning, OLAP and Data Mining options<br />ORA-39002:  invalid operation<br />ORA-39070: Unable to open the log file.<br />ORA-39087:  directory name EXPDIR is invalid</p> <p><strong>出现了错误，后来发现这个是因为新用户pangzi没有对目录的读写权限造成的，于是加上权限</strong></p> <p>SQL&gt; grant read,write on directory expdir to pangzi;</p> <p>授权成功。</p> <p>==================================================================================</p> <p><strong>出现了第二个错误</strong></p> <p>[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir  remap_tablespace=syb:pangzi</p> <p>Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012  18:47:38</p> <p>Copyright (c) 2003, 2005, Oracle.&nbsp; All rights reserved.</p> <p>Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 -  Production<br />With the Partitioning, OLAP and Data Mining options<br />ORA-31655:  no data or metadata objects selected for job<br />ORA-39154: Objects from foreign  schemas have been removed from import<br />Master table  "PANGZI"."SYS_IMPORT_FULL_01" successfully loaded/unloaded<br />Starting  "PANGZI"."SYS_IMPORT_FULL_01":&nbsp; pangzi/******** dumpfile=syb.dmp  directory=expdir remap_tablespace=syb:pangzi <br />Processing object type  SCHEMA_EXPORT/TABLE/TABLE_DATA<br />Job "PANGZI"."SYS_IMPORT_FULL_01" successfully  completed at 18:47:41</p> <p><strong>这个是由于原来的用户和现在的不一样了，加上这个参数就好了&nbsp;&nbsp;remap_schema=syb:pangzi</strong></p> <p>=====================================================================================================</p> <p><strong>下面是没有任何错误的导入了</strong></p> <p>[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir  remap_schema=syb:pangzi remap_tablespace=syb:pangzi</p> <p>Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012  18:49:24</p> <p>Copyright (c) 2003, 2005, Oracle.&nbsp; All rights reserved.</p> <p>Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 -  Production<br />With the Partitioning, OLAP and Data Mining options<br />Master  table "PANGZI"."SYS_IMPORT_FULL_01" successfully loaded/unloaded<br />Starting  "PANGZI"."SYS_IMPORT_FULL_01":&nbsp; pangzi/******** dumpfile=syb.dmp  directory=expdir remap_schema=syb:pangzi remap_tablespace=syb:pangzi  <br />Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA<br />Processing  object type SCHEMA_EXPORT/TABLE/TABLE<br />Processing object type  SCHEMA_EXPORT/TABLE/TABLE_DATA<br />. . imported  "PANGZI"."DYSPANGZI"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 48.50 KB&nbsp;&nbsp;&nbsp;&nbsp; 659 rows<br />. .  imported "PANGZI"."ALL_SALES"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13.68 KB&nbsp;&nbsp;&nbsp;&nbsp; 360  rows<br />&nbsp;&nbsp;&nbsp;&nbsp; 中间部分导入信息省略</p> <p>. . imported "PANGZI"."PURCHASES_WITH_TIMESTAMP"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.609 KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1  rows<br />. . imported "PANGZI"."REG_EXPS"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.437 KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1 rows<br />. . imported "PANGZI"."SALARY_GRADES"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.710  KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 rows<br />. . imported "PANGZI"."PRODUCT_PRICE_AUDIT"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0 KB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 rows<br />Processing object type  SCHEMA_EXPORT/TABLE/INDEX/INDEX<br />Processing object type  SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT<br />Processing object type  SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS<br />Processing object type  SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC<br />Processing object type  SCHEMA_EXPORT/FUNCTION/FUNCTION<br />Processing object type  SCHEMA_EXPORT/PROCEDURE/PROCEDURE<br />Processing object type  SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC<br />Processing  object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION<br />Processing object type  SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE<br />Processing object type  SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY<br />Processing object type  SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT<br />Processing object type  SCHEMA_EXPORT/TABLE/TRIGGER<br />Job "PANGZI"."SYS_IMPORT_FULL_01" successfully  completed at 18:49:37</p> <p>成功导入！！！！</p> <p><strong>查看默认的表空间</strong></p> <p>SQL&gt; select table_name,tablespace_name from user_tables; </p> <p>TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  TABLESPACE_NAME<br />------------------------------  ------------------------------<br />DYSPANGZI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />CUSTOMERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_TYPES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />EMPLOYEES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />SALARY_GRADES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_WITH_TIMESTAMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_TIMESTAMP_WITH_TZ&nbsp;&nbsp;&nbsp;  PANGZI<br />PURCHASES_WITH_LOCAL_TZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />COUPONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PANGZI</p> <p>TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  TABLESPACE_NAME<br />------------------------------  ------------------------------<br />PROMOTIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />ORDER_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_CHANGES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />MORE_PRODUCTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />MORE_EMPLOYEES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />DIVISIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />JOBS&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;  PANGZI<br />EMPLOYEES2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />ALL_SALES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />PRODUCT_PRICE_AUDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  PANGZI<br />REG_EXPS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PANGZI</p> <p>已选择22行。</p> <p><strong>此表空间中没有索引，所以第一种方法也没有报错，如果出现有索引的第一种方法还得增加几步，等我明天找到周五那个数据再来再着做试验。</strong></p> <p><strong>-----------------------------------------------------------</strong></p> <p><strong>今天特意去公司找来了那天导的数据库，回来做实验。采用第一种方法不可行，虽然说可以使用IMP&nbsp;  加indexs参数来导出一些索引，但是导入的时候总有莫名其妙的错误，估计还是我没弄好，所以为了省事还是直接用第二种吧，方便，无错。</strong></p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/397346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-04-03 12:07 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397346.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle 把一个表中的数据插入到另外一个表中</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397344.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 03 Apr 2013 04:05:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397344.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/397344.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397344.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/397344.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/397344.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">1.在<a href="http://www.linuxidc.com/topicnews.aspx?tid=12" target="_blank" title="Oracle" style="color: #b32bd5; ">Oracle</a>中可以用下面两种：</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">01:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; create table newtable&nbsp;&nbsp; as select * from oldtable;//用于复制前未创建新表newtable不存在的情况&nbsp;<br />02:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insert into newtable&nbsp;&nbsp; select * from oldtable;//已经创建了新表newtable 的情况</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">注意：第一种方式只是复制了表结构，但是主键什么的并没有复制进去，所以用的时候要小心在意。</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">2.如果想简单快速的复制表结构，而不需要oldtable里面的数据,可以用下面的语句：</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;&nbsp;&nbsp; create table newtable&nbsp;&nbsp; as&nbsp; select * from oldtable where 1=2;(把数据过滤掉)</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">3.如过newtable 和oldtable的表结构不同，可以使用下面的方式:</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;create table newtable&nbsp; as select&nbsp; s.c1,s.c2&nbsp; from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">4.如果想重新命名newtable的列名：</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">在oracle中:</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;create table&nbsp; newtable(id,name1) as select&nbsp; s.c1,s.c2&nbsp; from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">或者</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;create table&nbsp; newtable as select&nbsp; s.c1 ,s.c2&nbsp; from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">在mysql中恐怕只能用第二种方式了。</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">5.如果是只需要把一部分的oldtable中的数据添加到newtable中。可以这样：</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">&nbsp;create table newtable&nbsp;&nbsp; as (select * from oldtable where ...);//加where过滤条件</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">6.最常见的情况是id列新表中要用，并且和旧表中的不同，使用下面的语句就可以了（我们可以重新建一个sequence）</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">create table yang(id,name) as select hibernate_sequence.nextval,t.ename from emp t;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">7.要注意，导出表的时候不能用select...into语句。</p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/397344.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-04-03 12:05 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397344.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ssh 登陆redhat linux时中文显示乱码解决方法</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397345.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 03 Apr 2013 04:05:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397345.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/397345.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397345.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/397345.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/397345.html</trackback:ping><description><![CDATA[<span style="color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">方法1：</span><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">在shell中执行LANG=en 将语言设为英语就可以了.SSH下很多中文都不支持.</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">方法2：</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">在使用ssh远程控制redhat服务器时，中文显示为乱码。这个问题困扰了好久，后来发现修改i18n这个文件能够修正乱码。</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">方法如下：修改/etc/sysconfig/i18n文件，将其改成以下内容：</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">LANG="zh_CN.GB18030"<br style="padding: 0px; margin: 0px; " />LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"<br style="padding: 0px; margin: 0px; " />SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"<br style="padding: 0px; margin: 0px; " />SYSFONT="lat0-sun16"</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">重启机器，问题应该解决了。</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">方法3：</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">如果你用的是putty ，你只要在字符编码里选择utf-8就正常了</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">补充：这样做的后果是，在linux启动时，那些提示文字中文都变成了&#8220;？&#8221;符号。如果不习惯的话将ssh显示端改成英文吧。如下：</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">LANG=en_US &nbsp;</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/397345.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-04-03 12:05 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/04/03/397345.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java实现DES加密算法</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/03/29/397153.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Fri, 29 Mar 2013 07:58:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/03/29/397153.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/397153.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/03/29/397153.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/397153.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/397153.html</trackback:ping><description><![CDATA[<span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: times; "><span style="font-size: small; ">一、</span></span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; ">java</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; ">实现</span><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: times; ">DES</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; ">加密算法</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">为了实现一对密钥对整个项目所有加密解密文件都适用的方法,采用先生成一对密钥.保存到xml文件中,以后获得私匙和公钥只需要从xml文件中取得就可以了.</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: verdana; "><span style="font-size: small; ">/**</span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">*&nbsp;把成生的一对密钥保存到DesKey.xml文件中</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: times; "><span style="font-size: small; ">*/</span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">public static void saveDesKey(){ &nbsp; &nbsp;&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; try {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; SecureRandom sr = new SecureRandom();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; //为我们选择的DES算法生成一个KeyGenerator对象</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; KeyGenerator kg = KeyGenerator.getInstance ("DES" );</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; kg.init (sr);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; FileOutputStream fos = new FileOutputStream("C:/DesKey.xml");</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; ObjectOutputStream oos = new ObjectOutputStream(fos);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; //生成密钥</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; Key key = kg.generateKey();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; oos.writeObject(key);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; oos.close();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; } catch (Exception e) {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; e.printStackTrace();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; }</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: times; "><span style="font-size: small; ">}</span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">获取密钥方法如下:</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; "><br />/**</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">*&nbsp;获得DES加密的密钥。在交易处理的过程中应该定时更</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">*&nbsp;换密钥。需要JCE的支持，如果jdk版本低于1.4，则需要</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">*&nbsp;安装jce-1_2_2才能正常使用。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">* @return &nbsp; Key&nbsp;返回对称密钥</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">*/</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; public static Key getKey() {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; Key kp = null;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; try {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fileName = "conf/DesKey.xml";</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InputStream is = DesUtil.class.getClassLoader()</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getResourceAsStream(fileName);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ObjectInputStream oos = new ObjectInputStream(is);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kp = (Key) oos.readObject();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oos.close();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; return kp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; }</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">文件采用DES算法加密文件</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; "><br />/**<br />*&nbsp;文件file进行加密并保存目标文件destFile中<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">* @param&nbsp;file</span><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: verdana; "><br /><span style="font-size: small; ">* &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">要加密的文件&nbsp;如</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">c:/test/srcFile.txt<br />* @param destFile<br />* &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;加密后存放的文件名&nbsp;如c:/加密后文件</span><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: verdana; "><span style="font-size: small; ">.txt<br />*/<br /></span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">public static void encrypt(String file, String destFile) throws Exception {<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; Cipher cipher = Cipher.getInstance("DES");<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; cipher.init(Cipher.ENCRYPT_MODE, getKey());<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; InputStream is = new FileInputStream(file);<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; OutputStream out = new FileOutputStream(dest);<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; CipherInputStream cis = new CipherInputStream(is, cipher);<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; byte[] buffer = new byte[1024];<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; int r;<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; while ((r = cis.read(buffer)) &gt; 0) {<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.write(buffer, 0, r);<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; }<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; cis.close();<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; is.close();<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; out.close();<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; }</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">文件采用DES算法解密文件</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; "><br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; "><span style="font-size: small; ">/**<br />*&nbsp;</span>文件file进行加密并保存目标文件destFile中<br /></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">* @param&nbsp;file</span><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: verdana; "><br /><span style="font-size: small; ">* &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">已加密的文件&nbsp;如c:/加密后文件</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">.txt<br />* @param destFile<br />* &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;解密后存放的文件名&nbsp;如c:/ test/解密后文件</span><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: verdana; "><span style="font-size: small; ">.txt<br />*/<br /></span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="line-height: 25.200000762939453px; background-color: #ffffff; font-family: times; "><span style="font-size: small; ">public static void decrypt(String file, String dest) throws Exception {</span></span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; Cipher cipher = Cipher.getInstance("DES");</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; cipher.init(Cipher.DECRYPT_MODE, getKey());</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; InputStream is = new FileInputStream(file);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; OutputStream out = new FileOutputStream(dest);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; CipherOutputStream cos = new CipherOutputStream(out, cipher);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; byte[] buffer = new byte[1024];</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; int r;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; while ((r = is.read(buffer)) &gt;= 0) {</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cos.write(buffer, 0, r);</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; cos.close();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; out.close();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; &nbsp; &nbsp; is.close();</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.200000762939453px; background-color: #ffffff; font-size: small; ">&nbsp; &nbsp; }</span>&nbsp;<img src ="http://www.blogjava.net/weishuangshuang/aggbug/397153.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-03-29 15:58 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/03/29/397153.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux服务器RPM包制作</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/03/22/396834.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Fri, 22 Mar 2013 01:59:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/03/22/396834.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/396834.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/03/22/396834.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/396834.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/396834.html</trackback:ping><description><![CDATA[<strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">1、查看操作系统版本和内核版本</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#uname &#8211;a</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#more /etc/redhat-release</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">2</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、创建相关目录</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">/usr/src/redhat/SOURCES&nbsp;//存放源代码，补丁，图标等文件。</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/SPECS&nbsp;//存放用于管理rpm制作进程的spec文件。</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/BUILD&nbsp;//解压后的文件存放在这里。</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/RPMS&nbsp;//存放由rpmbuild制作好的二进制包。</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/SRPMS&nbsp;//存放由rpmbuild制作好的源码包。</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#mkdir -p /usr/src/redhat/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cd /usr/src/redhat/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#mkdir SOURCES SPECS BUILD RPMS SRPMS</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">3</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、下载</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">Nginx</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">源码包</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">下载源码包到SOURCES目录，不需要解压</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#wget&nbsp;<a href="http://nginx.org/download/nginx-1.3.9.tar.gz" target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/download/nginx-1.3.9.tar.gz</a></p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><span style="color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">4、手工创建SPEC文件</span><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">由于spec文件是由spec语言编写的，请注意spec语言的语法。</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cd /usr/src/redhat/SPECS/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cat &lt; nginx.spec &gt; EOC</p><table cellspacing="0" style="word-wrap: break-word; empty-cells: show; border-collapse: collapse; border-style: solid; border-color: #e3edf5; table-layout: auto; width: 696px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; font-size: 14px; line-height: 21px; text-align: start; background-color: #ffffff; "><tbody style="word-wrap: break-word; "><tr style="word-wrap: break-word; "><td width="568" style="word-wrap: break-word; padding: 4px; border-style: solid; border-color: #e3edf5; overflow: hidden; ">&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Summary:&nbsp;&nbsp;High Performance Web Server</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Name:&nbsp;&nbsp;nginx</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Version:&nbsp;&nbsp;1.3.9</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Release:&nbsp;&nbsp;el5</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">License:&nbsp;&nbsp;GPL</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Group:&nbsp;&nbsp;Applications/Server</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Source:&nbsp;&nbsp;<a href="http://nginx.org/download/nginx-1.3.9.tar.gz" target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/download/nginx-1.3.9.tar.gz</a></p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">URL:&nbsp;&nbsp;<a href="http://nginx.org/" target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/</a></p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Distribution:&nbsp;&nbsp;Linux</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Packager:&nbsp;&nbsp;JingSheng &lt;<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#106;&#105;&#110;&#103;&#115;&#104;&#101;&#110;&#103;&#49;&#64;&#115;&#116;&#97;&#102;&#102;&#46;&#115;&#105;&#110;&#97;&#46;&#99;&#111;&#109;&#46;&#99;&#110;" target="_blank" style="word-wrap: break-word; color: #336699; ">jingsheng1@staff.sina.com.cn</a>&gt;</p>&nbsp;&nbsp;<br style="word-wrap: break-word; " />&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%description</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">nginx&nbsp;&nbsp;[engine x] is a HTTP and reverse proxy server</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%prep</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">useradd&nbsp;&nbsp;nginx -s /sbin/nologin</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">rm -rf&nbsp;&nbsp;$RPM_BUILD_DIR/nginx-1.3.9</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">zcat&nbsp;&nbsp;$RPM_SOURCE_DIR/nginx-1.3.9.tar.gz | tar -xvf -</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%build</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">cd&nbsp;&nbsp;$RPM_BUILD_DIR/nginx-1.3.9</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">./configure&nbsp;&nbsp;--user=nginx --group=nginx --prefix=/usr/local/nginx/ --with-http_stub_status_module&nbsp;&nbsp;--with-http_ssl_module</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">make</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%install</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">cd&nbsp;&nbsp;$RPM_BUILD_DIR/nginx-1.3.9</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">make&nbsp;&nbsp;install</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%preun</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">if [ -z&nbsp;&nbsp;"`ps aux | grep nginx | grep -v grep`" ];then</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">killall&nbsp;&nbsp;nginx &gt;/dev/null</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">exit 0</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">fi</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%files</p>&nbsp;&nbsp;<p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">/usr/local/nginx</p>&nbsp;&nbsp;</td></tr></tbody></table><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#:以#开头是注释，rpm会忽略它。<br style="word-wrap: break-word; " />Summary：简单描述软件。<br style="word-wrap: break-word; " />Name ：定义rpm的名称。<br style="word-wrap: break-word; " />Version: 定义软件版本<br style="word-wrap: break-word; " />Release: 发行版本<br style="word-wrap: break-word; " />License: 定义许可证<br style="word-wrap: break-word; " />Group: 软件分类<br style="word-wrap: break-word; " />Source: 源码下载地址<br style="word-wrap: break-word; " />URL: 源码相关网站<br style="word-wrap: break-word; " />Distribution: 发行版系列<br style="word-wrap: break-word; " />Packager: 打包人的信息</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">scription:软件详细描述，可多行<br style="word-wrap: break-word; " />%prep ：软件编译之前的处理，如解压。<br style="word-wrap: break-word; " />%build ：开始编译软件，如make<br style="word-wrap: break-word; " />%install :开始安装软件，如make install<br style="word-wrap: break-word; " />%files :指定哪些文件需要被打包，如/usr/local/nginx<br style="word-wrap: break-word; " />%preun :定义卸载之前的动作，如杀掉进程。</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">5</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、开始</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">RPM</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">制作</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">在制作RPM包之前，需要安装必要的编译工具</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#yum install -y gcc rpm-build pcre-devel</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">开始编译生成rpm包</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "># rpmbuild-bb nginx.spec</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "></p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">注意：如果安装生成报错，请将安装过的东东全部去除，再重新打包</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "># rpm &#8211;qpl *.rpm 查看rpm包含哪些</p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/396834.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-03-22 09:59 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/03/22/396834.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Xmanager远程连接Redhat5</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395874.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Thu, 28 Feb 2013 12:06:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395874.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/395874.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395874.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/395874.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/395874.html</trackback:ping><description><![CDATA[<p>最近一直在折腾linux，centos、redhat装了又装，到最后还是装了redhat。</p>
<p>以前多少接触过linux，但是都不深入（这次虽然也是皮毛，但是稍微知道了一些东东，现在就卖了），这次从零开始自己折腾linux，确实是被linux折腾了。linux跟windows确实有很多不同，有机会再继续介绍，这次先说一下使用Xmanager远程连接Redhat的经历。</p>
<p>Xmanager不多说了，是一款非常不错的管理工具。但是，如果要让Xmanager远程连接redhat，其实远程连接，主要还是想要做成跟windows的远程桌面一样的东西，图形界面方便啦！<br /></p>
<p>只是这次配置Xmanager相当痛苦，按照网上各种资料对redhat进行配置，然后不停的reboot，但是，xmanager总是连不上。<br /></p>
<p>这其中，修改的文件包括：</p>
<p>/usr/share/gdm/defaults.conf这个gdm的配置文件，主要是以下内容：</p>
<p>Enable=true</p>
<p>DisplaysPerHost=10</p>
<p>Port=177</p>
<p>还有/etc/inittab文件，主要是首先默认级别为5，这个文件貌似在安装的时候就已经默认为5了。id:5:initdefault:</p>
<p>然后最后一行的&#8220;x:5:respawn:/etc/X11/prefdm -nodaemon&#8221;调整为：</p>
<p>x:5:respawn:/usr/sbin/gdm</p>
<p>当然，还得改！</p>
<p>依然是/usr/share/gdm/defaults.conf，在[security]中调整以下的值：</p>
<p>AllowRoot=true</p>
<p>AllowRemoteRoot=true<br /></p>
<p>AllowRemoteAutoLogin=true<br /></p>
<p>如果开着防火墙，那还是要放开177端口，我暂时把防火墙关了。</p>
<p>reboot！reboot总是很重要的！</p>
<p>如果上述调整完成之后，依然无法连接，我就是这样的情况，连接不上啊！！！！</p>
<p>又随便找了几篇文章，也许跟hosts文件有关系哦！<br /></p>
<p>打开/etc/hosts文件一看，空的！！！</p>
<p>在其中加上127.0.0.1 localhost，reboot，我总是喜欢reboot，这样比较干净！比较彻底！</p>
<p>在Xstart中配置好相应的参数，一定要在Commond中选择&#8220;GNOME&#8221;，这样再Run，Xbrowser将久违的redhat桌面打开了！</p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/395874.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-02-28 20:06 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395874.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SecureCRT使用SSH连接linux超时后自动断开</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395873.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Thu, 28 Feb 2013 12:04:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395873.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/395873.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395873.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/395873.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/395873.html</trackback:ping><description><![CDATA[<p style="border-bottom: 0px; text-align: left; border-left: 0px; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); list-style-type: none; text-indent: 0px; margin: 10px 0px; padding-left: 0px; padding-right: 0px; font: 12px/18px Arial, Helvetica, sans-serif; word-wrap: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(73,73,73); word-break: break-all; border-top: 0px; border-right: 0px; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">今天开发的同事，和我说</p>
<p style="border-bottom: 0px; text-align: left; border-left: 0px; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); list-style-type: none; text-indent: 0px; margin: 10px 0px; padding-left: 0px; padding-right: 0px; font: 12px/18px Arial, Helvetica, sans-serif; word-wrap: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(73,73,73); word-break: break-all; border-top: 0px; border-right: 0px; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">SecureCRT连接到IDC服务器，老超时断开，影响工作了</p>
<p style="border-bottom: 0px; text-align: left; border-left: 0px; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); list-style-type: none; text-indent: 0px; margin: 10px 0px; padding-left: 0px; padding-right: 0px; font: 12px/18px Arial, Helvetica, sans-serif; word-wrap: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(73,73,73); word-break: break-all; border-top: 0px; border-right: 0px; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">研究了下。</p>
<p style="border-bottom: 0px; text-align: left; border-left: 0px; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); list-style-type: none; text-indent: 0px; margin: 10px 0px; padding-left: 0px; padding-right: 0px; font: 12px/18px Arial, Helvetica, sans-serif; word-wrap: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(73,73,73); word-break: break-all; border-top: 0px; border-right: 0px; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">因为客户端与<a style="color: rgb(72,111,145); text-decoration: none" href="http://space.itpub.net/8183550/viewspace-689103" target="_self"><u style="word-break: break-all"><strong style="word-break: break-all; font-weight: bold">服务器</strong></u></a>之间存在路由器，防火墙以及为了本身的安全性，在超过特定的时间后就会把空闲连接断开。或者是服务器端设置了断开空闲连接。<br style="line-height: normal !important; word-break: break-all" /><strong style="line-height: normal !important; word-break: break-all; font-weight: bold"><font style="line-height: 18px; word-wrap: normal; word-break: break-all" color="#ff0000">解决方法：</font></strong><br style="line-height: normal !important; word-break: break-all" />既然会断开超时的空闲连接，那么我们就应该让客户端与服务器之间的连接&#8220;忙&#8221;起来，方法有两个:<br style="line-height: normal !important; word-break: break-all" />从服务器方面入手：<br style="line-height: normal !important; word-break: break-all" />修改/etc/ssh/sshd_config配置文件 ClientAliveInterval 300（默认为0）<br style="line-height: normal !important; word-break: break-all" />这个参数的是意思是每5分钟，服务器向客户端发一个消息，用于保持连接<br style="line-height: normal !important; word-break: break-all" />service sshd reload 生效<br style="line-height: normal !important; word-break: break-all" /><font style="line-height: normal !important; word-wrap: normal; word-break: break-all" color="#ff0000"><strong style="word-break: break-all; font-weight: bold">从客户端入手：<br style="line-height: normal !important; word-break: break-all" /></strong></font>上面是配置需要服务器权限，如果没有服务器权限则可以使用这个方法，其思想是：客户端向服务器发一个消息，用于保持连接<br style="line-height: normal !important; word-break: break-all" />secureCRT在选项 终端 反空闲 中设置每隔多少秒发送一个字符串，或者是NO-OP协议包<br style="line-height: normal !important; word-break: break-all" />putty：putty -&gt; Connection -&gt; Seconds between keepalives ( 0 to turn off ), 默认为0, 改为300</p><br /><span style="text-align: center; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: bold 20px/20px simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(44,44,44); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">CentOS 5远程SSH连接超时设定</span><br />
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(234,236,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/28px 宋体, 'Arial narrow', arial, serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(44,44,44); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; line-height: 21px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Verdana; word-wrap: normal; word-break: normal; padding-top: 0px">操作系统：CentOS 5.6&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr></span><span style="padding-bottom: 0px; line-height: 21px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Verdana; word-wrap: normal; word-break: normal; padding-top: 0px">SSH版本：OpenSSH_4.3p2</span></div>
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(234,236,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/28px 宋体, 'Arial narrow', arial, serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(44,44,44); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; line-height: 21px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Verdana; word-wrap: normal; word-break: normal; padding-top: 0px">网上很多文章都说，远程SSH连接的超时设定是在/etc/ssh/sshd_config里，使用ClientAliveInterval和ClientAliveCountMax选项，我原来也这么认为的，不过一直没配置过超时。</span></div>
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(234,236,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/28px 宋体, 'Arial narrow', arial, serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(44,44,44); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; line-height: 21px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Verdana; word-wrap: normal; word-break: normal; padding-top: 0px">今天配置了一下，发现这个是不对的，正确的配置是在/etc/profile里，使用TMOUT选项进行控制，如TMOUT=300，设定超时间隔为300秒。</span></div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/395873.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-02-28 20:04 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/02/28/395873.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于多用户远程桌面的实现——WIN7 版</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393877.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Sun, 06 Jan 2013 08:00:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393877.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/393877.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/393877.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/393877.html</trackback:ping><description><![CDATA[<p>远程桌面服务使局域网 (LAN) 上的计算机可以连接到服务器（也称为远程计算机）并运行位于服务器上的程序。这可以只需要在1台机器上安装应用程序，其他机器共享使用。远程桌面连接使用远程桌面服务技术，使一台计算机可远程控制另一台计算机。</p><p>windows 远程终端服务是单用户的，也就是说通过远程登录到服务器时，服务器本地将黑屏。如何做到不管用本地登录还是远程登录，同一时刻容许多个用户操作服务器计算机。</p><p>首先：</p><p>要安装工具包，需要从微软下载(远程服务器管理工具 <a href="http://www.microsoft.com/downloads/zh-cn/details.aspx?displaylang=zh-cn&amp;FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d">http://www.microsoft.com/downloads/zh-cn/details.aspx?displaylang=zh-cn&amp;FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d</a> )，安装升级包后，在控制面板--程序和功能--打开或关闭WINDOWS功能---远程服务器管理工具--角色管理工具--远程桌面服务工具，选中前面的选择框。<br />在开始--命令框输入cmd,在弹出的Dos界面输入netstat -na ,如果出现 3389 端口，就说明远程终端已经启动了。</p><p>然后：</p><p>1, 下载 补丁UniversalTermsrvPatch，功能就是去除单用户登陆的限制，允许多人多用户同时并行访问登录。<br />2, 根据你的系统运行对应的程序：<br />   32位系统请运行 UniversalTermsrvPatch-x86.exe;<br />   64位系统请运行 UniversalTermsrvPatch-x64.exe。<br />3, 需要管理员权限。右键点程序，选择以管理员身份运行。<br />4, 破解后需要重启生效。<br />5, 备份文件： \windows\system32\termsrv.dll.backup.(如果想还原设置 请将备份文件改名为termsrv.dll替换破解的文件即可)</p><p>远程桌面的其它可能的设置：<br />  运行gpedit.msc打开组策略，计算机配置－管理模板－Windows组件－远程桌面服务－远程桌面会话主机-连接-&#8220;限制连接数量&#8221;，如果将状态设置为&#8220;禁用&#8221;或&#8220;未配置&#8221;，则在&#8220;组策略&#8221;级别上不强制限制连接的数量。</p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/393877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-01-06 16:00 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Windows Server2003远程桌面多用户连接的问题</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393874.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Sun, 06 Jan 2013 07:59:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393874.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/393874.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393874.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/393874.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/393874.html</trackback:ping><description><![CDATA[<div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">在Windows 2003系统上的远程桌面实际上就是终端服务，虽然远程桌面最初在Windows XP上就已经存在，但由于Windows XP的远程桌面功能，只能提供一个用户使用计算机，因此使用率并不高。而Windows 2003提供的远程桌面功能则可供多用户同时使用，在其上可以运行程序、保存文件和使用网络资源，在很多方面可以像使用终端一样，并且在管理及配置方面比原来的终端服务更方便。要更好地发挥远程桌面的作用就要对远程桌面进行相应的配置。 www.2cto.com &nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp; 组策略编译器（gpedit.msc）配置</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">使用组策略编译器配置用户远程连接数以及用户会话数，</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">1，&#8220;开始&#8221;&#8212;&gt;&#8220;运行&#8221;输入gpedit.msc回车打开组策略编译器-&gt;&#8220;计算机配置&#8221;-&gt;&#8220;管理模板&#8221;-&gt;&#8220;<a href="http://www.2cto.com/os/windows/" target="_blank" style="color: #333333; text-decoration: none; ">windows</a>组件&#8221;-&gt;&#8220;终端服务&#8221;,右侧鼠标右键选择&#8220;限制连接数&#8221;打开属性，选择&#8220;设置&#8221;&#8212;&gt;选择&#8220;已启用&#8221;， &nbsp;&#8220;TS &nbsp; &nbsp;允许的最大连接数&#8221;填写你所需要的数量，例如：20。确定完成最大连接数限制设置。双击&#8220;会话&#8221;-&gt;选择&#8220;为断开的会话设置时间限制&#8221;右键选择属性-》&#8220;设置&#8221;-&gt;xuanze选择&#8220;已启用&#8221;-》&#8220;结束断开连接会话&#8221;填写合适的时间，五分钟为好。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　终端服务配置(Tscc.msc)的使用</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　使用终端服务配置可以更改本地计算机上该连接的属性、添加新连接或设置服务器。打开&#8220;控制面板&#8221;&#8212;〉&#8220;管理工具&#8221;，单击&#8220;终端服务器配置&#8221;启动终端服务配置窗口。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　1 单击左边窗口的&#8220;连接&#8221;项，右边窗口即出现可选的RDP-TCP连接，右击&#8220;RDP-TCP&#8221;，选&#8220;属性&#8221;出现RDP-Tcp属性对话框，主要配置有:</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(1)连接数设置:可在&#8220;网卡&#8221;选项中更改。设置更多地连接数可使更多的用户同时登录服务器。默认最多同时两个用户连接，如果想要使3个以上的用户同时使用远程桌面功能，则必须安装终端服务，安装后就可以任意设定用户数制。 &nbsp;www.2cto.com &nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　安装终端服务可通过Windows的&#8220;添加/删除程序&#8221;&#8212;〉&#8220;添加/删除Windows组件&#8221;中，选中&#8220;终端服务器&#8221;来添加，根据需要完成相应配置，完成终端服务安装，重启机器生效。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　由于每个用户连接远程桌面后最小占用12MB左右的内存，因此可根据服务器内存大小来设定用户数，一般用户数不要太多，以免影响性能。如256MB内存可设定用户数8个左右，512MB内存可设定20~30个。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(2)调整颜色分辨率(颜色深度):在&#8220;客户端设置&#8221;项中。限制颜色深度可以增强连接性能，尤其是对于慢速链接，并且还可以减轻服务器负载。&#8220;远程桌面&#8221;连接的当前默认最大颜色深度设置为 16 位。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　选中&#8220;颜色深度最大值&#8221;，可修改限定的最大颜色深度为8、15、16或24位。若不选中，则使用登录的客户端颜色设置。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(3)让客户自动登录:在&#8220;登录设置&#8221;选项卡上。这对普通应用非常方便，可加快登录速度，提高服务效率。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　要使用自动登录，需选中&#8220;总是使用下列登录信息&#8221;，在&#8220;用户名&#8221;中，键入允许自动登录到服务器的用户的名称，在&#8220;密码&#8221;和&#8220;确认密码&#8221;中，键入该用户的密码。 这样客户端连接时将不用再输入用户名和密码，而自动进入Windows 2003桌面(注意:若此后再有用户登录，那么原来的连接将被断开)。若输入不完整，则登录时还会要求输入用户名或密码。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　如要想更安全的使用服务器，则应选中&#8220;总是提示密码&#8221;以指定该用户在登录到服务器之前始终要被提示输入密码，从而限制客户端的自动登录。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(4)对连接自动限制管理:单击&#8220;会话&#8221;项来设定。主要用来设定超时的限制，以便释放会话所占用的资源，&#8220;结束已断开的会话&#8221;和&#8220;空闲会话限制&#8221;的时间，一般应用设为5分钟较好。对安全性要求高的也可设定&#8220;活动会话限制&#8221;的时间。&#8220;达到会话限制或者连接被中断时&#8221;下的选项，最好选&#8220;结束会话&#8221;，这样连接所占的资源就会被释放。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(5)设置加密级别:单击&#8220;常规&#8221;项，可指定在终端服务会话期间，对于客户端与远程计算机之间发送的所有数据是否强制加密级别。分四个级别:符合 FIPS(最高级别的加密)、高(加密数据经过强 128 位加密。)、客户端兼容(加密数据经过客户端支持的最大密钥强度加密)和低(从服务器发送到客户端的数据将不会被加密)。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(6)启用终端客户音频:在&#8220;客户端设置&#8221;项下边，默认为禁用，以节约服务器资源。当用户少时 ，单击&#8220;音频映射&#8221;去掉被禁用的选项，使终端客户能使用多媒体设备。当然，客户端计算机也必须装有声卡。 &nbsp;www.2cto.com &nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　如果有多个用户连接到相同的服务器，则会以同一个用户名登录。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(7)启用驱动器映射;此项可方便终端与服务器磁盘间文件的相互传送。启用后本地驱动器将作为网络驱动器显示在终端中。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　同样还有打印机、剪贴板、com端口等也可设置映射。但每设置一个都要占用一定的系统资源;所以，一般用户最好禁用。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">　　(8)服务器的安全设置:在&#8220;权限&#8221;项，可选择组或用户，限制其对终端的配置权限。另外，由于只有Administrators 和 Remote Desktop Users 组的成员可以使用终端服务连接与远程计算机连接，所以可对不同用户分组管理，对于要求安全性高的，可利用NTFS分区设置不同用户的权限。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp;</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&#8220;服务器设置&#8221;&#8212;》&#8220;限制每个用户使用一个会话&#8221;右键选择属性，去除&#8220;限制每个用户使用一个会话&#8221;的勾选，确认完成设置。</div><div style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">&nbsp; 整个多用户的远程连接设置到此结束。</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/393874.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-01-06 15:59 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393874.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Windows Server 2003中安装终端服务器组件</title><link>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393876.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Sun, 06 Jan 2013 07:59:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393876.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/393876.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393876.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/393876.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/393876.html</trackback:ping><description><![CDATA[<div exp-content-block-1"="" style="font-family: arial, 宋体, sans-serif; background-color: #ffffff; "><div style="text-align: justify; "><div style="padding-right: 10px; padding-left: 10px; margin-top: 15px; "><div>在远程管理方面，Windows Server 2003系统一个最明显的进步就是增加了&#8220;远程桌面&#8221;功能。这样一来，从Windows 2000保留下来的终端服务似乎就显得有点多余了。然而情况并不是这样，因为在不安装&#8220;终端服务器&#8221;的前提下，&#8220;远程桌面&#8221;功能的可管理性比较有限。搭建终端服务器以后，对Windows 2000 Server和Windows Server 2003系统的远程管理操作将更加灵活。<br />在Windows Server 2003（SP1）中默认没有安装终端服务器组件，用户需要手动添加该组件。安装终端服务组件的步骤如下所述：</div></div></div></div><div exp-content-block-2"="" style="font-family: arial, 宋体, sans-serif; background-color: #ffffff; "><h2>步骤/方法</h2><div style="text-align: justify; "><ol style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; list-style-type: none; list-style-position: initial; list-style-image: initial; clear: both; "><li list-item-1"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_1.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第1步，在开始菜单中依次单击&#8220;控制面板&#8221;&#8594;&#8220;添加或删除程序&#8221;菜单项，打开&#8220;添加或删除程序&#8221;窗口。然后单击&#8220;添加/删除Windows组件&#8221;按钮，打开&#8220;Windows组件向导&#8221;对话框。在&#8220;组件&#8221;列表中选中&#8220;终端服务器&#8221;复选框，如图2008112107所示。<br />图2008112107 选中&#8220;终端服务器&#8221;复选框</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=1" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/bbe0d3118da6f57db9127bb8.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-2"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_2.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第2步，打开&#8220;配置警告&#8221;对话框，提示用户关于IE安全配置方面的信息。因为配置终端服务器的目的主要是为了远程管理Windows Server 2003服务器，对于浏览Internet方面的要求并不高，因此直接单击&#8220;是&#8221;按钮。返回&#8220;Windows组件&#8221;对话框，选中&#8220;终端服务器授权&#8221;复选框，并单击&#8220;下一步&#8221;&#8594;&#8220;下一步&#8221;按钮即可，如图2008112108所示。<br />图2008112108 &#8220;配置警告&#8221;对话框</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=2" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/5202e5f22f32217eb07ec5b6.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-3"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_3.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第3步，在打开的为应用程序兼容性选择默认权限对话框中列出两种安装模式，即&#8220;完整安全模式&#8221;和&#8220;宽松安全模式&#8221;。选择不同的模式会应用到Windows Server 2003系统的不同安全级别。选中&#8220;完整安全模式&#8221;单选框，并单击&#8220;下一步&#8221;按钮，如图2008112109所示。<br />图2008112109 选中&#8220;完整安全模式&#8221;单选框</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=3" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/e865a699ff2ffe656e068cb9.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-4"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_4.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第4步，打开指定终端服务器许可证服务器对话框，提示用户该终端服务器必须在120天内与Windows Server 2003终端服务器许可证服务器连接才能保证正常使用。由于在&#8220;Windows组件&#8221;对话框中选中了&#8220;终端服务器授权&#8221;复选框，则意味着这台Windows Server 2003终端服务器将同时作为许可证服务器。因此选中&#8220;使用下列许可证服务器&#8221;单选框，并在编辑框中输入这台服务器的名称或IP地址。设置完毕单击&#8220;下一步&#8221;按钮，如图2008112110所示。<br />图2008112110 输入许可证服务器IP地址</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=4" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/7e7f79093e1ec2a23bc763b6.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-5"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_5.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第5步，在打开的终端服务器授权模式对话框中，要求用户指定这台终端服务器使用的授权模式。选中&#8220;每设备授权模式&#8221;单选框，并单击&#8220;下一步&#8221;按钮，如图2008112111所示。<br />图200811211 选中&#8220;每设备授权模式&#8221;单选框</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=5" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/5beeba0f60df4980ab6457b6.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-6"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_6.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第6步，打开&#8220;终端服务器授权安装程序&#8221;对话框，要求用户选择安装许可证服务器数据库的路径。一般可以保持默认路径，并单击&#8220;下一步&#8221;按钮，如图2008112112所示。<br />图2008112112 选择许可证服务器数据库路径</div><div><div><a href="http://jingyan.baidu.com/album/2d5afd69b281fc85a2e28ebc.html?picindex=6" target="_self" style="text-decoration: none; color: #238ba5; "><img alt="在Windows Server 2003中安装终端服务器组件" src="http://hiphotos.baidu.com/exp/pic/item/8759287a9d90f8802e73b3b7.jpg" style="border-top-width: 1.5px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-style: initial; border-color: initial; border-image: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ffffff; border-right-color: #ffffff; border-bottom-color: #ffffff; border-left-color: #ffffff; " /></a></div></div></li><li list-item-7"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px !important; padding-right: 0px !important; padding-bottom: 22px !important; padding-left: 35px !important; background-image: url(http://img.baidu.com/img/iknow/exp/editor/icon_list_item_7.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; min-height: 20px; height: auto; zoom: 1; background-position: 0px 3px; background-repeat: no-repeat no-repeat; "><div>第7步，Windows组件向导开始安装终端服务器和终端服务器授权组件，在安装过程中要求提供Windows Server 2003（SP1）系统的安装光盘或指定安装程序路径。完成安装后单击&#8220;完成&#8221;按钮关闭Windows组件向导，并按照提示重新启动计算机。</div></li></ol></div></div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/393876.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2013-01-06 15:59 <a href="http://www.blogjava.net/weishuangshuang/archive/2013/01/06/393876.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SAX解析XML</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/12/25/393468.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Tue, 25 Dec 2012 08:52:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/12/25/393468.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/393468.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/12/25/393468.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/393468.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/393468.html</trackback:ping><description><![CDATA[<div>package com;</div><div>&nbsp;&nbsp;</div><div>&nbsp; import java.io.FileInputStream;</div><div>&nbsp; import java.io.InputStream;</div><div>&nbsp; import java.util.ArrayList;</div><div>&nbsp; import java.util.List;</div><div>&nbsp;&nbsp;</div><div>&nbsp; import javax.xml.parsers.SAXParser;</div><div>&nbsp; import javax.xml.parsers.SAXParserFactory;</div><div>&nbsp;&nbsp;</div><div>&nbsp; import org.xml.sax.Attributes;</div><div>&nbsp; import org.xml.sax.SAXException;</div><div>&nbsp; import org.xml.sax.helpers.DefaultHandler;</div><div>&nbsp;&nbsp;</div><div>&nbsp; /**</div><div>&nbsp; &nbsp;* SAX解析XML，事件驱动</div><div>&nbsp; &nbsp;* 只有两种节点</div><div>&nbsp; &nbsp;* Element Node元素节点</div><div>&nbsp; &nbsp;* Text Node文本节点&nbsp;</div><div>&nbsp; &nbsp;*/</div><div>&nbsp; public class SaxResolveXML {</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>public static void main(String[] args){</div><div>&nbsp; <span style="white-space:pre">		</span>try {</div><div>&nbsp; <span style="white-space:pre">			</span>SaxResolveXML saxResolveXML = new SaxResolveXML();</div><div>&nbsp; <span style="white-space:pre">			</span>InputStream inStream = new FileInputStream("D:\\xml.xml");</div><div>&nbsp; <span style="white-space:pre">			</span>List&lt;Person&gt; list = saxResolveXML.getList(inStream);</div><div>&nbsp; <span style="white-space:pre">			</span>for(Person person : list){</div><div>&nbsp; <span style="white-space:pre">				</span>System.out.println(person.toString());</div><div>&nbsp; <span style="white-space:pre">			</span>}</div><div>&nbsp; <span style="white-space:pre">		</span>} catch (Exception e) {</div><div>&nbsp; <span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>public List&lt;Person&gt; getList(InputStream inStream) throws Exception {</div><div>&nbsp; <span style="white-space:pre">		</span>SAXParserFactory factory = SAXParserFactory.newInstance();</div><div>&nbsp; <span style="white-space:pre">		</span>SAXParser parse = factory.newSAXParser();</div><div>&nbsp; <span style="white-space:pre">		</span>SaxResolve saxResolve = new SaxResolve();</div><div>&nbsp; <span style="white-space:pre">		</span>parse.parse(inStream, saxResolve);</div><div>&nbsp; <span style="white-space:pre">		</span>inStream.close();</div><div>&nbsp; <span style="white-space:pre">		</span>return saxResolve.getPerson();</div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>private final class SaxResolve extends DefaultHandler {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">		</span>private List&lt;Person&gt; list = null;</div><div>&nbsp; <span style="white-space:pre">		</span>private Person person = null;</div><div>&nbsp; <span style="white-space:pre">		</span>private String tag = null;</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">		</span>public List&lt;Person&gt; getPerson(){</div><div>&nbsp; <span style="white-space:pre">			</span>return list;</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">		</span>//开始文档事件</div><div>&nbsp; <span style="white-space:pre">		</span>public void startDocument() throws SAXException {</div><div>&nbsp; <span style="white-space:pre">			</span>//初始化</div><div>&nbsp; <span style="white-space:pre">			</span>list = new ArrayList&lt;Person&gt;();</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">		</span>//开始元素语法事件 &nbsp;参数说明：命名空间、不带命名空间的标签名、含有命名空间前缀的标签名、属性</div><div>&nbsp; <span style="white-space:pre">		</span>public void startElement(String uri, String localName, String qName,</div><div>&nbsp; <span style="white-space:pre">				</span>Attributes atts) throws SAXException {</div><div>&nbsp; <span style="white-space:pre">			</span>if("person".equals(qName)){</div><div>&nbsp; <span style="white-space:pre">				</span>person = new Person();</div><div>&nbsp; <span style="white-space:pre">				</span>person.setId(Integer.parseInt(atts.getValue(0)));</div><div>&nbsp; <span style="white-space:pre">			</span>}</div><div>&nbsp; <span style="white-space:pre">			</span>tag = qName;</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">		</span>//触发文本节点事件 &nbsp;参数说明：整个xml内容的字符串、当前读到文本类型的开始位置、当前读到文本的数据长度</div><div>&nbsp; <span style="white-space:pre">		</span>public void characters(char[] ch, int start, int length)</div><div>&nbsp; <span style="white-space:pre">				</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">			</span>if(tag != null){</div><div>&nbsp; <span style="white-space:pre">				</span>String data = new String(ch, start, length);</div><div>&nbsp; <span style="white-space:pre">				</span>if(tag.equals("name")){</div><div>&nbsp; <span style="white-space:pre">					</span>person.setName(data);</div><div>&nbsp; <span style="white-space:pre">				</span>}else if(tag.equals("age")){</div><div>&nbsp; <span style="white-space:pre">					</span>person.setAge(Integer.parseInt(data));</div><div>&nbsp; <span style="white-space:pre">				</span>}</div><div>&nbsp; <span style="white-space:pre">			</span>}</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">		</span>//结束元素语法事件 &nbsp;参数说明：命名空间、不带命名空间的标签名、含有命名空间前缀的标签名</div><div>&nbsp; <span style="white-space:pre">		</span>public void endElement(String uri, String localName, String qName)</div><div>&nbsp; <span style="white-space:pre">				</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">			</span>if("person".equals(qName)){</div><div>&nbsp; <span style="white-space:pre">				</span>list.add(person);</div><div>&nbsp; <span style="white-space:pre">				</span>person = null;</div><div>&nbsp; <span style="white-space:pre">				</span>//对象设为空</div><div>&nbsp; <span style="white-space:pre">			</span>}</div><div>&nbsp; <span style="white-space:pre">			</span>tag = null;</div><div>&nbsp; <span style="white-space:pre">		</span>}</div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>/*//开始文档事件</div><div>&nbsp; <span style="white-space:pre">	</span>public void startDocument() throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>//开始元素语法事件 &nbsp;参数说明：命名空间、不带命名空间的标签名、含有命名空间前缀的标签名、属性</div><div>&nbsp; <span style="white-space:pre">	</span>public void startElement(String uri, String localName, String qName,</div><div>&nbsp; <span style="white-space:pre">			</span>Attributes atts) throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>//触发文本节点事件 &nbsp;参数说明：整个xml内容的字符串、当前读到文本类型的开始位置、当前读到文本的数据长度</div><div>&nbsp; <span style="white-space:pre">	</span>public void characters(char[] ch, int start, int length)</div><div>&nbsp; <span style="white-space:pre">			</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; <span style="white-space:pre">	</span>//结束元素语法事件 &nbsp;参数说明：命名空间、不带命名空间的标签名、含有命名空间前缀的标签名</div><div>&nbsp; <span style="white-space:pre">	</span>public void endElement(String uri, String localName, String qName)</div><div>&nbsp; <span style="white-space:pre">			</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void endDocument() throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void endPrefixMapping(String prefix) throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void ignorableWhitespace(char[] ch, int start, int length)</div><div>&nbsp; <span style="white-space:pre">			</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void processingInstruction(String target, String data)</div><div>&nbsp; <span style="white-space:pre">			</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void setDocumentLocator(Locator locator) {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void skippedEntity(String name) throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}</div><div>&nbsp;&nbsp;</div><div>&nbsp; <span style="white-space:pre">	</span>public void startPrefixMapping(String prefix, String uri)</div><div>&nbsp; <span style="white-space:pre">			</span>throws SAXException {</div><div>&nbsp; <span style="white-space:pre">		</span></div><div>&nbsp; <span style="white-space:pre">	</span>}*/</div><div>&nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;xml文件如下：</div><div>&nbsp;&lt;?xml version="1.0" encoding="UTF-8"?&gt;</div><div>&nbsp; &lt;persons&gt;</div><div>&nbsp; &nbsp; &nbsp; &lt;person id="1"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;name&gt;liming&lt;/name&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;age&gt;23&lt;/age&gt;</div><div>&nbsp; &nbsp; &nbsp; &lt;/person&gt;</div><div>&nbsp; &nbsp; &nbsp; &lt;person id="2"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;name&gt;lixiangmei&lt;/name&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;age&gt;24&lt;/age&gt;</div><div>&nbsp; &nbsp; &nbsp; &lt;/person&gt;</div><div>&nbsp; &lt;/persons&gt;</div><div>&nbsp;&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/393468.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-12-25 16:52 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/12/25/393468.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux 安装matlab，运行时找不到各种文件的解决方案</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/11/16/391464.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Fri, 16 Nov 2012 08:24:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/11/16/391464.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/391464.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/11/16/391464.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/391464.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/391464.html</trackback:ping><description><![CDATA[<img src="http://www.blogjava.net/images/blogjava_net/weishuangshuang/QQ截图20121116154611.jpg" width="753" height="447" alt="" /><br /><br /><br /><br />export&nbsp;LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/runtime/glnx86:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/os/glnx86:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386<br />export&nbsp;XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/X11/app-defaults<br /><br />把以上两行加入系统的环境变量里面：具体操作如下：<br />vi&nbsp;/etc/profile<br />按 i 就可以编辑这个文件，开始复制<br />把上面两行拷贝到这个文件的最下面然后保存就可以了！<br />保存退出时先按一下&#8220;ESC&#8221;，然后再按&#8220;:wq&#8221;就可以保存退出了！<img src ="http://www.blogjava.net/weishuangshuang/aggbug/391464.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-11-16 16:24 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/11/16/391464.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>向oracle数据库存储文件，并读出文件</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/10/19/389866.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Fri, 19 Oct 2012 05:17:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/10/19/389866.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/389866.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/10/19/389866.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/389866.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/389866.html</trackback:ping><description><![CDATA[<div>/**</div><div>&nbsp;<span style="white-space:pre">	</span> * 从数据库中查询IRI和KLO模型的数据，并下载到本地</div><div>&nbsp;<span style="white-space:pre">	</span> * @param dataTime &nbsp; &nbsp; &nbsp; &nbsp; 时次</div><div>&nbsp;<span style="white-space:pre">	</span> * @param outIRIFilePath &nbsp; IRI文件下载到本地的路径</div><div>&nbsp;<span style="white-space:pre">	</span> * @param outKLOFilePath &nbsp; KLO文件下载到本地的路径</div><div>&nbsp;<span style="white-space:pre">	</span> * @param outAnaFilePath &nbsp; 插值文件下载到本地的路径</div><div>&nbsp;<span style="white-space:pre">	</span> */</div><div>&nbsp;<span style="white-space:pre">	</span>@SuppressWarnings("static-access")</div><div>&nbsp;<span style="white-space:pre">	</span>public static void selectBlogInfo(String dataTime, String outIRIFilePath, String outKLOFilePath, String outAnaFilePath) {</div><div>&nbsp;<span style="white-space:pre">		</span>try {</div><div>&nbsp;<span style="white-space:pre">			</span>Connection con = DBConnectionManager.getInstance().getConnection();</div><div>&nbsp;<span style="white-space:pre">			</span>Statement st = con.createStatement();</div><div>&nbsp;<span style="white-space:pre">			</span>String sql = "select * from MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24')";</div><div>&nbsp;<span style="white-space:pre">			</span>ResultSet rs = st.executeQuery(sql);</div><div>&nbsp;<span style="white-space:pre">			</span>if (rs.next()) {</div><div>&nbsp;<span style="white-space:pre">				</span>Blob blod = rs.getBlob("IRIDATA");</div><div>&nbsp;<span style="white-space:pre">				</span>InputStream reader = blod.getBinaryStream();</div><div>&nbsp;<span style="white-space:pre">				</span>dataTime = dataTime.replaceAll("-", "");</div><div>&nbsp;<span style="white-space:pre">				</span>dataTime = dataTime.replaceAll(" ", "");</div><div>&nbsp;<span style="white-space:pre">				</span>String iriFilePath = outIRIFilePath+"\\"+dataTime+"0000.iri.grd";</div><div>&nbsp;<span style="white-space:pre">				</span>File file = new File(iriFilePath);</div><div>&nbsp;<span style="white-space:pre">				</span>OutputStream writer;</div><div>&nbsp;<span style="white-space:pre">				</span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div>&nbsp;<span style="white-space:pre">				</span>byte buf[] = new byte[1024];</div><div>&nbsp;<span style="white-space:pre">				</span>for (int i = 0; (i = reader.read(buf)) &gt; 0;) {</div><div>&nbsp;<span style="white-space:pre">					</span>writer.write(buf, 0, i);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>writer.close();</div><div>&nbsp;<span style="white-space:pre">				</span>reader.close();</div><div>&nbsp;<span style="white-space:pre">				</span></div><div>&nbsp;<span style="white-space:pre">				</span>blod = rs.getBlob("IRIDATA");</div><div>&nbsp;<span style="white-space:pre">				</span>reader = blod.getBinaryStream();</div><div>&nbsp;<span style="white-space:pre">				</span>String kloFilePath = outKLOFilePath+"\\"+dataTime+"0000.klo.grd";</div><div>&nbsp;<span style="white-space:pre">				</span>file = new File(kloFilePath);</div><div>&nbsp;<span style="white-space:pre">				</span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div>&nbsp;<span style="white-space:pre">				</span>buf = new byte[1024];</div><div>&nbsp;<span style="white-space:pre">				</span>for (int i = 0; (i = reader.read(buf)) &gt; 0;) {</div><div>&nbsp;<span style="white-space:pre">					</span>writer.write(buf, 0, i);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>writer.close();</div><div>&nbsp;<span style="white-space:pre">				</span>reader.close();</div><div>&nbsp;<span style="white-space:pre">				</span></div><div>&nbsp;<span style="white-space:pre">				</span>blod = rs.getBlob("ANADATA");</div><div>&nbsp;<span style="white-space:pre">				</span>reader = blod.getBinaryStream();</div><div>&nbsp;<span style="white-space:pre">				</span>String anaFilePath = outAnaFilePath+"\\"+dataTime+"0000.grd";</div><div>&nbsp;<span style="white-space:pre">				</span>file = new File(anaFilePath);</div><div>&nbsp;<span style="white-space:pre">				</span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div>&nbsp;<span style="white-space:pre">				</span>buf = new byte[1024];</div><div>&nbsp;<span style="white-space:pre">				</span>for (int i = 0; (i = reader.read(buf)) &gt; 0;) {</div><div>&nbsp;<span style="white-space:pre">					</span>writer.write(buf, 0, i);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>writer.close();</div><div>&nbsp;<span style="white-space:pre">				</span>reader.close();</div><div>&nbsp;<span style="white-space:pre">			</span>}</div><div>&nbsp;<span style="white-space:pre">			</span>DBConnectionManager.closeConnection();</div><div>&nbsp;<span style="white-space:pre">			</span>if(con!=null){con.close();}</div><div>&nbsp;<span style="white-space:pre">			</span>if(st!=null){st.close();}</div><div>&nbsp;<span style="white-space:pre">			</span>if(rs!=null){rs.close();}</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (SQLException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (FileNotFoundException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (IOException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>}</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>/**</div><div>&nbsp;<span style="white-space:pre">	</span> * 把IRI和KLO模型的文件上传到数据库中</div><div>&nbsp;<span style="white-space:pre">	</span> * @param dataTime &nbsp; &nbsp; 时次</div><div>&nbsp;<span style="white-space:pre">	</span> * @param iriFilePath &nbsp;要上传IRI文件的绝对路径</div><div>&nbsp;<span style="white-space:pre">	</span> * @param kloFilePath &nbsp;要上传KLO文件的据对路径</div><div>&nbsp;<span style="white-space:pre">	</span> * @param ANAFilePath &nbsp;要上传插值文件的据对路径</div><div>&nbsp;<span style="white-space:pre">	</span> */</div><div>&nbsp;<span style="white-space:pre">	</span>@SuppressWarnings("static-access")</div><div>&nbsp;<span style="white-space:pre">	</span>public static void insertBlogInfo(String dataTime, String IRIFilePath, String KLOFilePath, String ANAFilePath) {</div><div>&nbsp;<span style="white-space:pre">		</span>try {</div><div>&nbsp;<span style="white-space:pre">			</span>Connection con = DBConnectionManager.getInstance().getConnection();</div><div>&nbsp;<span style="white-space:pre">			</span>// 处理事务</div><div>&nbsp;<span style="white-space:pre">			</span>boolean defaultCommit;</div><div>&nbsp;<span style="white-space:pre">			</span>defaultCommit = con.getAutoCommit();</div><div>&nbsp;<span style="white-space:pre">			</span></div><div>&nbsp;<span style="white-space:pre">			</span>con.setAutoCommit(false);</div><div>&nbsp;<span style="white-space:pre">			</span>Statement st = con.createStatement();</div><div>&nbsp;<span style="white-space:pre">			</span></div><div>&nbsp;<span style="white-space:pre">			</span>String sql = "select * from MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24')";</div><div>&nbsp;<span style="white-space:pre">			</span>ResultSet rs = st.executeQuery(sql);</div><div>&nbsp;<span style="white-space:pre">			</span>if(rs.next()){</div><div>&nbsp;<span style="white-space:pre">				</span>System.out.println(dataTime+"时次已经入库！");</div><div>&nbsp;<span style="white-space:pre">				</span>return ;</div><div>&nbsp;<span style="white-space:pre">			</span>}</div><div>&nbsp;<span style="white-space:pre">			</span>// 插入一个空对象</div><div>&nbsp;<span style="white-space:pre">			</span>sql = "insert into MODELTEC(ID, DATATIME, IRIDATA, KLODATA, ANADATA) values(" +</div><div>&nbsp;<span style="white-space:pre">					</span>"SEQU_MODEL_ID.nextval, " +</div><div>&nbsp;<span style="white-space:pre">					</span>"to_date('"+dataTime+"','YYYY-mm-dd HH24'), " +</div><div>&nbsp;<span style="white-space:pre">					</span>"empty_blob(), " +</div><div>&nbsp;<span style="white-space:pre">					</span>"empty_blob(), " +</div><div>&nbsp;<span style="white-space:pre">					</span>"empty_blob())";</div><div>&nbsp;<span style="white-space:pre">			</span>st.executeUpdate(sql);</div><div>&nbsp;<span style="white-space:pre">			</span>// 用for update方式锁定数据行</div><div>&nbsp;<span style="white-space:pre">			</span>sql = "select IRIDATA,KLODATA,ANADATA from &nbsp;MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24') for update";</div><div>&nbsp;<span style="white-space:pre">			</span>rs = st.executeQuery(sql);</div><div>&nbsp;<span style="white-space:pre">			</span>if (rs.next()) {</div><div>&nbsp;<span style="white-space:pre">				</span>// 得到java.sql.Blob对象，然后Cast为oracle.sql.BLOB</div><div>&nbsp;<span style="white-space:pre">				</span>BLOB blob = (BLOB) rs.getBlob("IRIDATA");</div><div>&nbsp;<span style="white-space:pre">				</span>// 到数据库的输出流</div><div>&nbsp;<span style="white-space:pre">				</span>OutputStream outStream = blob.getBinaryOutputStream();</div><div>&nbsp;<span style="white-space:pre">				</span>// 这里用一个文件模拟输入流</div><div>&nbsp;<span style="white-space:pre">				</span>InputStream fin = new FileInputStream(new File(IRIFilePath));</div><div>&nbsp;<span style="white-space:pre">				</span>// 将输入流写到输出流</div><div>&nbsp;<span style="white-space:pre">				</span>byte[] b = new byte[blob.getBufferSize()];</div><div>&nbsp;<span style="white-space:pre">				</span>int len = 0;</div><div>&nbsp;<span style="white-space:pre">				</span>while ((len = fin.read(b)) != -1) {</div><div>&nbsp;<span style="white-space:pre">					</span>outStream.write(b, 0, len);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>// 依次关闭（注意顺序）</div><div>&nbsp;<span style="white-space:pre">				</span>fin.close();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.flush();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.close();</div><div>&nbsp;<span style="white-space:pre">				</span></div><div>&nbsp;<span style="white-space:pre">				</span>// 得到java.sql.Blob对象，然后Cast为oracle.sql.BLOB</div><div>&nbsp;<span style="white-space:pre">				</span>blob = (BLOB) rs.getBlob("KLODATA");</div><div>&nbsp;<span style="white-space:pre">				</span>// 到数据库的输出流</div><div>&nbsp;<span style="white-space:pre">				</span>outStream = blob.getBinaryOutputStream();</div><div>&nbsp;<span style="white-space:pre">				</span>// 这里用一个文件模拟输入流</div><div>&nbsp;<span style="white-space:pre">				</span>fin = new FileInputStream(new File(IRIFilePath));</div><div>&nbsp;<span style="white-space:pre">				</span>// 将输入流写到输出流</div><div>&nbsp;<span style="white-space:pre">				</span>b = new byte[blob.getBufferSize()];</div><div>&nbsp;<span style="white-space:pre">				</span>len = 0;</div><div>&nbsp;<span style="white-space:pre">				</span>while ((len = fin.read(b)) != -1) {</div><div>&nbsp;<span style="white-space:pre">					</span>outStream.write(b, 0, len);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>// 依次关闭（注意顺序）</div><div>&nbsp;<span style="white-space:pre">				</span>fin.close();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.flush();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.close();</div><div>&nbsp;<span style="white-space:pre">				</span></div><div>&nbsp;<span style="white-space:pre">				</span>// 得到java.sql.Blob对象，然后Cast为oracle.sql.BLOB</div><div>&nbsp;<span style="white-space:pre">				</span>blob = (BLOB) rs.getBlob("ANADATA");</div><div>&nbsp;<span style="white-space:pre">				</span>// 到数据库的输出流</div><div>&nbsp;<span style="white-space:pre">				</span>outStream = blob.getBinaryOutputStream();</div><div>&nbsp;<span style="white-space:pre">				</span>// 这里用一个文件模拟输入流</div><div>&nbsp;<span style="white-space:pre">				</span>fin = new FileInputStream(new File(ANAFilePath));</div><div>&nbsp;<span style="white-space:pre">				</span>// 将输入流写到输出流</div><div>&nbsp;<span style="white-space:pre">				</span>b = new byte[blob.getBufferSize()];</div><div>&nbsp;<span style="white-space:pre">				</span>len = 0;</div><div>&nbsp;<span style="white-space:pre">				</span>while ((len = fin.read(b)) != -1) {</div><div>&nbsp;<span style="white-space:pre">					</span>outStream.write(b, 0, len);</div><div>&nbsp;<span style="white-space:pre">				</span>}</div><div>&nbsp;<span style="white-space:pre">				</span>// 依次关闭（注意顺序）</div><div>&nbsp;<span style="white-space:pre">				</span>fin.close();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.flush();</div><div>&nbsp;<span style="white-space:pre">				</span>outStream.close();</div><div>&nbsp;<span style="white-space:pre">				</span></div><div>&nbsp;<span style="white-space:pre">				</span>con.commit();</div><div>&nbsp;<span style="white-space:pre">				</span>/* 恢复原提交状态 */</div><div>&nbsp;<span style="white-space:pre">				</span>con.setAutoCommit(defaultCommit);</div><div>&nbsp;<span style="white-space:pre">				</span>DBConnectionManager.closeConnection();</div><div>&nbsp;<span style="white-space:pre">				</span>if(con!=null){con.close();}</div><div>&nbsp;<span style="white-space:pre">				</span>if(st!=null){st.close();}</div><div>&nbsp;<span style="white-space:pre">				</span>if(rs!=null){rs.close();}</div><div>&nbsp;<span style="white-space:pre">			</span>}</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (SQLException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (FileNotFoundException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (IOException e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>} catch (Exception e) {</div><div>&nbsp;<span style="white-space:pre">			</span>e.printStackTrace();</div><div>&nbsp;<span style="white-space:pre">		</span>}</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/389866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-10-19 13:17 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/10/19/389866.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java Data、String、Long三种日期类型之间的相互转换</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388712.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Thu, 27 Sep 2012 09:07:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388712.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388712.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388712.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388712.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388712.html</trackback:ping><description><![CDATA[<div>&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">	</span>// date类型转换为String类型</div><div>&nbsp;<span style="white-space:pre">	</span>// formatType格式为yyyy-MM-dd HH:mm:ss//yyyy年MM月dd日 HH时mm分ss秒</div><div>&nbsp;<span style="white-space:pre">	</span>// data Date类型的时间</div><div>&nbsp;<span style="white-space:pre">	</span>public static String dateToString(Date data, String formatType) {</div><div>&nbsp;<span style="white-space:pre">		</span>return new SimpleDateFormat(formatType).format(data);</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>// long类型转换为String类型</div><div>&nbsp;<span style="white-space:pre">	</span>// currentTime要转换的long类型的时间</div><div>&nbsp;<span style="white-space:pre">	</span>// formatType要转换的string类型的时间格式</div><div>&nbsp;<span style="white-space:pre">	</span>public static String longToString(long currentTime, String formatType)</div><div>&nbsp;<span style="white-space:pre">			</span>throws ParseException {</div><div>&nbsp;<span style="white-space:pre">		</span>Date date = longToDate(currentTime, formatType); // long类型转成Date类型</div><div>&nbsp;<span style="white-space:pre">		</span>String strTime = dateToString(date, formatType); // date类型转成String</div><div>&nbsp;<span style="white-space:pre">		</span>return strTime;</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>// string类型转换为date类型</div><div>&nbsp;<span style="white-space:pre">	</span>// strTime要转换的string类型的时间，formatType要转换的格式yyyy-MM-dd HH:mm:ss//yyyy年MM月dd日</div><div>&nbsp;<span style="white-space:pre">	</span>// HH时mm分ss秒，</div><div>&nbsp;<span style="white-space:pre">	</span>// strTime的时间格式必须要与formatType的时间格式相同</div><div>&nbsp;<span style="white-space:pre">	</span>public static Date stringToDate(String strTime, String formatType)</div><div>&nbsp;<span style="white-space:pre">			</span>throws ParseException {</div><div>&nbsp;<span style="white-space:pre">		</span>SimpleDateFormat formatter = new SimpleDateFormat(formatType);</div><div>&nbsp;<span style="white-space:pre">		</span>Date date = null;</div><div>&nbsp;<span style="white-space:pre">		</span>date = formatter.parse(strTime);</div><div>&nbsp;<span style="white-space:pre">		</span>return date;</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>// long转换为Date类型</div><div>&nbsp;<span style="white-space:pre">	</span>// currentTime要转换的long类型的时间</div><div>&nbsp;<span style="white-space:pre">	</span>// formatType要转换的时间格式yyyy-MM-dd HH:mm:ss//yyyy年MM月dd日 HH时mm分ss秒</div><div>&nbsp;<span style="white-space:pre">	</span>public static Date longToDate(long currentTime, String formatType)</div><div>&nbsp;<span style="white-space:pre">			</span>throws ParseException {</div><div>&nbsp;<span style="white-space:pre">		</span>Date dateOld = new Date(currentTime); // 根据long类型的毫秒数生命一个date类型的时间</div><div>&nbsp;<span style="white-space:pre">		</span>String sDateTime = dateToString(dateOld, formatType); // 把date类型的时间转换为string</div><div>&nbsp;<span style="white-space:pre">		</span>Date date = stringToDate(sDateTime, formatType); // 把String类型转换为Date类型</div><div>&nbsp;<span style="white-space:pre">		</span>return date;</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>// string类型转换为long类型</div><div>&nbsp;<span style="white-space:pre">	</span>// strTime要转换的String类型的时间</div><div>&nbsp;<span style="white-space:pre">	</span>// formatType时间格式</div><div>&nbsp;<span style="white-space:pre">	</span>// strTime的时间格式和formatType的时间格式必须相同</div><div>&nbsp;<span style="white-space:pre">	</span>public static long stringToLong(String strTime, String formatType)</div><div>&nbsp;<span style="white-space:pre">			</span>throws ParseException {</div><div>&nbsp;<span style="white-space:pre">		</span>Date date = stringToDate(strTime, formatType); // String类型转成date类型</div><div>&nbsp;<span style="white-space:pre">		</span>if (date == null) {</div><div>&nbsp;<span style="white-space:pre">			</span>return 0;</div><div>&nbsp;<span style="white-space:pre">		</span>} else {</div><div>&nbsp;<span style="white-space:pre">			</span>long currentTime = dateToLong(date); // date类型转成long类型</div><div>&nbsp;<span style="white-space:pre">			</span>return currentTime;</div><div>&nbsp;<span style="white-space:pre">		</span>}</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><div>&nbsp;</div><div>&nbsp;<span style="white-space:pre">	</span>// date类型转换为long类型</div><div>&nbsp;<span style="white-space:pre">	</span>// date要转换的date类型的时间</div><div>&nbsp;<span style="white-space:pre">	</span>public static long dateToLong(Date date) {</div><div>&nbsp;<span style="white-space:pre">		</span>return date.getTime();</div><div>&nbsp;<span style="white-space:pre">	</span>}</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388712.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-27 17:07 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388712.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux操作FTP用户</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388709.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Thu, 27 Sep 2012 09:00:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388709.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388709.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388709.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388709.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388709.html</trackback:ping><description><![CDATA[1、新建用户<br />useradd 用户名(gpsin) -g 当前登录用户(root) -d 根目录(/home/weiss) -s /sbin/nologin(不是用于登录) &nbsp; &nbsp; &nbsp;&nbsp;<br />passwd 用户名(为该用户创建密码)<br />2、删除用户<br />userdel 用户名(gpsin)<br />3、修改用户根目录<br />usermod -d 新目录(/home/wei) 用户名(gpsin)<br /><br /><br /><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388709.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-27 17:00 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/27/388709.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>命令操作ftp</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/26/388575.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 26 Sep 2012 05:00:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/26/388575.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388575.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/26/388575.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388575.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388575.html</trackback:ping><description><![CDATA[window：需要两个文件<br />一个要执行的bat文件 test.bat<br />文件内容：ftp -n -s:C:\\config.txt 127.0.0.1<br />另一个操作ftp的命令文件 config.txt<br />文件内容：<br />user user<br />pass<div>ls<br />put ......<br />get ......&nbsp;<br />bye<br /><br />linux：只需要一个文件即可也就是sh文件<br />test.sh<br />文件内容：ftp -i -n 127.0.0.1<br />user user pass<br />bin<br />ls<br />put ......<br />get ......&nbsp;<br />bye<br /><br /><br />ftp -nv 127.0.0.1 &lt;&lt;EOF<br />user user pass<br />bin<br />prompt<br />lcd /home<br />put ......<br />get ......<br />quit<br /></div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388575.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-26 13:00 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/26/388575.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c3p0连接池</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/20/388187.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Thu, 20 Sep 2012 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/20/388187.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388187.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/20/388187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388187.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388187.html</trackback:ping><description><![CDATA[<div><span style="font-size: 8pt; ">package db;</span></div><div></div><div><span style="font-size: 8pt; ">import java.beans.PropertyVetoException;</span></div><div><span style="font-size: 8pt; ">import java.sql.Connection;</span></div><div><span style="font-size: 8pt; ">import java.sql.SQLException;</span></div><div></div><div><span style="font-size: 8pt; ">import com.mchange.v2.c3p0.ComboPooledDataSource;</span></div><div></div><div><span style="font-size: 8pt; ">public class DBPool {</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">private ComboPooledDataSource dataSource;</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">public static Connection con;</span></div><div></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">public DBPool() {</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource = new ComboPooledDataSource();</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setUser("test");</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setPassword("test");</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:orcl");</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setDriverClass("oracle.jdbc.driver.OracleDriver");</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setInitialPoolSize(2);</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setMinPoolSize(1);</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setMaxPoolSize(10);</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setMaxStatements(50);</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setMaxIdleTime(60);</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">dataSource.setAcquireRetryAttempts(3); &nbsp;&nbsp;</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">} catch (PropertyVetoException e) {</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">}</span></div><div></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">public final static DBPool getInstance() {</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">return new DBPool();</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">}</span></div><div></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">public final Connection getConnection() {</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">return dataSource.getConnection();</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">} catch (SQLException e) {</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">return null;</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">}</span></div><div><br /><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//测试方法</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">public static void main(String[] args) throws SQLException {</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">con = DBPool.getInstance().getConnection();</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">System.out.println(con);</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">if (con != null){con.close();}</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">} catch (SQLException e) {</span></div><div><span style="white-space:pre">			</span><span style="font-size: 8pt; ">e.printStackTrace();</span></div><div><span style="white-space:pre">		</span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre">	</span><span style="font-size: 8pt; ">}</span></div><div><span style="font-size: 8pt; ">}</span><br /><br /><br /><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">&nbsp; &nbsp;<span style="font-size: 8pt; ">//初始化时获取三个连接，取值应在minPoolSize与maxPoolSize之间。Default: 3 initialPoolSize&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; cpds.setInitialPoolSize(initialPoolSize);&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //连接池中保留的最大连接数。Default: 15 maxPoolSize&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; cpds.setMaxPoolSize(maxPoolSize);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //连接池中保留的最小连接数。&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; cpds.setMinPoolSize(minPoolSize);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //获得连接的最大等待毫秒数。Default: 1000 acquireRetryDelay<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; cpds.setAcquireRetryDelay(acquireRetryDelay);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 maxIdleTime&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; cpds.setMaxIdleTime(maxIdleTime);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 acquireIncrement&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setAcquireIncrement(3);&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //每60秒检查所有连接池中的空闲连接。Default: 0 idleConnectionTestPeriod&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setIdleConnectionTestPeriod(60);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //连接关闭时默认将所有未提交的操作回滚。Default: false autoCommitOnClose&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setAutoCommitOnClose(true);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //JDBC的标准参数，用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。如果maxStatements与maxStatementsPerConnection均为0，则缓存被关闭。Default: 0<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setMaxStatements(1);</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setMaxStatementsPerConnection(100);</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //定义所有连接测试都执行的测试语句。在使用连接测试的情况下这个一显著提高测试速度。注意：测试的表必须在初始数据源的时候就存在。Default: null preferredTestQuery&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setPreferredTestQuery("select sysdate from dual");&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; // 因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; // 时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; // 等方法来提升连接测试的性能。Default: false testConnectionOnCheckout&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setTestConnectionOnCheckout(true);<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //如果设为true那么在取得连接的同时将校验连接的有效性。Default: false testConnectionOnCheckin&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setTestConnectionOnCheckin(true);&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 acquireRetryAttempts&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setAcquireRetryAttempts(30);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //保留，并在下次调用getConnection()的时候继续尝试获取连接。如果设为true，那么在尝试&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //获取连接失败后该数据源将申明已断开并永久关闭。Default: false breakAfterAcquireFailure&nbsp;&nbsp;&nbsp;<br /></span><span style="font-size: 8pt; ">&nbsp;&nbsp;&nbsp; //cpds.setBreakAfterAcquireFailure(false); &nbsp;&nbsp;</span></p><div>&nbsp; <span style="font-size: 8pt; ">//两次连接中间隔时间，单位毫秒。Default: 1000 acquireRetryDelay</span></div><div><span style="font-size: 8pt; ">&nbsp; cpds.setAcquireRetryDelay(60000);</span></div><div></div><br /><div clearfix"=""><h2><span style="font-size: 8pt; ">java.lang.AbstractMethodError:  oracle.jdbc.driver.OracleResultSetImpl.getClob(异常解决办法</span></h2></div> <div id="content" mod-cs-content="" text-content=""  clearfix"=""> <p><span style="font-size: 8pt; ">最近遇到了一个头痛的问题，可能大家也遇到过。经过多番的询问与查找，终于知道问题原因的所在：异常内容如下：</span></p> <p><span style="font-size: 8pt; ">java.lang.AbstractMethodError:  oracle.jdbc.driver.OracleResultSetImpl.getClob(Ljava/lang/String;)Ljava/sql/Clob;</span></p> <p><span style="font-size: 8pt; ">问题原因：Oracle驱动版本不对</span></p> <p><span style="font-size: 8pt; ">解决办法：在Oracle服务器上找到这个驱动，然后cp到Apache的lib目录下，并同是修改环境变量classpath，保证这个lib/classes12.jar在最前面；修改完后，重新启动服务，问题就可以解决。<br /></span></p><div>（ojdbc14.jar在<span style="font-size: 12px; ">classes12.jar前面）</span></div><p>&nbsp;</p></div></div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-20 15:21 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/20/388187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>redhat新建用户作为ftp用户</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388067.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 19 Sep 2012 06:25:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388067.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388067.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388067.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388067.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388067.html</trackback:ping><description><![CDATA[<div>useradd gpsin -g root -d /inraw -s /sbin/nologin &nbsp; &nbsp; #该用户仅用来支持FTP服务，因此不必让他登录系统<br />gpsin是ftp登录的用户名，root指定哪个用户可以使用该ftp用户，-d /inraw 指定ftp的根目录，-s /sbin/nologin不用于登录<br /><br /><br />passwd gpsin &nbsp; &nbsp;给gpsin用户设置密码</div><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388067.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-19 14:25 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388067.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RedHat 安装rar</title><link>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388066.html</link><dc:creator>甜咖啡</dc:creator><author>甜咖啡</author><pubDate>Wed, 19 Sep 2012 06:21:00 GMT</pubDate><guid>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388066.html</guid><wfw:comment>http://www.blogjava.net/weishuangshuang/comments/388066.html</wfw:comment><comments>http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388066.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weishuangshuang/comments/commentRss/388066.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weishuangshuang/services/trackbacks/388066.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">1.</span><span style="font-family: ZYSong18030; ">下载</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">rarlinux-3.7.1.tar.zip</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">#unzip rarlinux-3.7.1.tar.zip</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">#cd rar</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">#make</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-family: ZYSong18030; ">#make install<br /><br /></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><div>运行 rar --help 可以看到帮助信息，如果出现下列信息：</div><div>&nbsp;#rar: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by rar)</div><div>&nbsp;#rar: /lib/tls/libc.so.6: version `GLIBC_2.7' not found (required by rar)</div><div>&nbsp;则执行：</div><div>&nbsp;#cp -f rar_static /usr/local/bin/rar</div><div>&nbsp;这样就可以使用rar 命令了。</div></p><img src ="http://www.blogjava.net/weishuangshuang/aggbug/388066.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weishuangshuang/" target="_blank">甜咖啡</a> 2012-09-19 14:21 <a href="http://www.blogjava.net/weishuangshuang/archive/2012/09/19/388066.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>