﻿<?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/mmwy/</link><description>搬家==》&lt;a href="http://www.soapui.cn"&gt;www.soapui.cn&lt;/a&gt;</description><language>zh-cn</language><lastBuildDate>Wed, 29 Apr 2026 21:57:14 GMT</lastBuildDate><pubDate>Wed, 29 Apr 2026 21:57:14 GMT</pubDate><ttl>60</ttl><item><title>Struts2 的datetimepicker Taglib，在使用freemarker做result type时的问题</title><link>http://www.blogjava.net/mmwy/archive/2007/04/20/112136.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Fri, 20 Apr 2007 02:26:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2007/04/20/112136.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/112136.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2007/04/20/112136.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/112136.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/112136.html</trackback:ping><description><![CDATA[struts 2.0.6GA开始试螃蟹，照着struts2的tag文档写成&lt;@s.datetimepicker/&gt;，结果老是报错<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">211672</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">http-8080-Processor25</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"> ERROR freemarker.runtime  - <br />on line </span><span style="color: rgb(0, 0, 0);">7</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> column </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> in admin/index.ftl s.datetimepicker not found.<br />The problematic instruction:<br />----------<br /></span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&gt; user-directive s.datetimepicker </span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">on line 7, column 17 in admin/index.ftl</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"><br />----------<br /><br />Java backtrace for programmers:<br />----------<br />freemarker.core.InvalidReferenceException: on line </span><span style="color: rgb(0, 0, 0);">7</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> column </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> in admin/index.ftl s.datetimepicker not found.</span></div><br />试着google一下，正好有人也提交了这个<a href="https://issues.apache.org/struts/browse/WW-1757;jsessionid=82068AAD2673F25E4E128FE2F519FB88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel">bug</a>，改成 &lt;@s.dateTimePicker /&gt;，问题解决<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">The fix is as follows:<br /><br />In struts2-core-</span><span style="color: rgb(0, 0, 0);">2.0.6</span><span style="color: rgb(0, 0, 0);">:<br />org.apache.struts2.views.freemarker.tags.StrutsModels<br /><br />has a method<br />getDateTimePicker()<br /><br />Which should be re-named:<br />getDatetimepicker()<br /><br />to match with the naming convention.</span></div><br /><br /><img src="http://www.blogjava.net/images/blogjava_net/mmwy/hello,struts2.jpg" alt="hello,struts2.jpg" border="0" height="635" width="301" /><br /><img src ="http://www.blogjava.net/mmwy/aggbug/112136.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2007-04-20 10:26 <a href="http://www.blogjava.net/mmwy/archive/2007/04/20/112136.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>让birt2.1.x支持rtf、ppt、xls</title><link>http://www.blogjava.net/mmwy/archive/2007/04/08/109240.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Sun, 08 Apr 2007 07:42:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2007/04/08/109240.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/109240.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2007/04/08/109240.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/109240.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/109240.html</trackback:ping><description><![CDATA[来自：http://www.javaworld.com.tw/jute/post/print?bid=11&amp;id=166588<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">.Re:BIRT報表工具的問題 </span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">Re: uxa</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);">     Copy to clipboard<br />Posted by: uxa<br />Posted on: </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">09</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">15</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">15</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">28</span><span style="color: rgb(0, 0, 0);"><br /><br />經過幾次的失敗後~~小弟終於試出來了<br />不過感覺它似乎只是support xls file format並沒有excel的一些功能&gt; &lt;<br /><br /></span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">. download eclipse plugin BIRT，小弟抓的是birt-report-designer-all-in-one-2_1_</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">.zip<br />將其解開後把eclipse\plugins和eclipse\features這兩個目錄放到eclipse的目錄底下<br />現在將eclipse打開，您已經可以開始設計報表了。<br /><br /></span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">. BIRT預設有支援HTML和PDF的格式，以下說明如何支援xls格式<br />a. download xls-emitter-bin_2</span><span style="color: rgb(0, 0, 0);">.1.0</span><span style="color: rgb(0, 0, 0);">.zip，解開後將plugins複製到eclipse\plugins下<br />b. download poi-bin-</span><span style="color: rgb(0, 0, 0);">3.0</span><span style="color: rgb(0, 0, 0);">-alpha2-</span><span style="color: rgb(0, 0, 0);">20060616</span><span style="color: rgb(0, 0, 0);">.zip，解開後將jar檔複製到eclipse\plugins\ org.uguess.birt.report.engine.emitter.xls_2</span><span style="color: rgb(0, 0, 0);">.1.0.200607031206</span><span style="color: rgb(0, 0, 0);">\lib<br />c. xls-emitter-bin_2</span><span style="color: rgb(0, 0, 0);">.1.0</span><span style="color: rgb(0, 0, 0);">.zip解開後有個path的目錄，<br />(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">) 將org.eclipse.birt.report.designer.ui目錄下的檔案複製到eclipse\plugins\org.eclipse.birt.report.designer.ui.preview_2</span><span style="color: rgb(0, 0, 0);">.1.0</span><span style="color: rgb(0, 0, 0);">.*.jar<br />(</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)將org.eclipse.birt.report.viewer目錄下的檔案複製到eclipse\plugins\ org.eclipse.birt.report.viewer_2</span><span style="color: rgb(0, 0, 0);">.1.0</span><span style="color: rgb(0, 0, 0);">.*\birt\WEB-INF\lib\viewservlets.jar<br />(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">)將org.eclipse.birt.report.engine目錄下的檔案複製到eclipse\plugins\org.eclipse.birt.report.engine_2</span><span style="color: rgb(0, 0, 0);">.1.0</span><span style="color: rgb(0, 0, 0);">.*.jar<br /><br />完成後啟動eclipse可看到在view report的按鈕上多了xls和ppt兩種格式<br /><br />BIRT下載位置：http://download.eclipse.org/birt/downloads/<br />Tribix下載位置：https://sourceforge.net/projects/tribix<br />ps：請注意版本的問題，BIRT2</span><span style="color: rgb(0, 0, 0);">.1</span><span style="color: rgb(0, 0, 0);">.0請搭配Tribix XLS Emitter </span><span style="color: rgb(0, 0, 0);">2.1</span><span style="color: rgb(0, 0, 0);">.0版本，在置換檔名的部份也請注意路徑是否正確</span></div><br /><img src ="http://www.blogjava.net/mmwy/aggbug/109240.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2007-04-08 15:42 <a href="http://www.blogjava.net/mmwy/archive/2007/04/08/109240.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在birt2.1.2中显示条形码</title><link>http://www.blogjava.net/mmwy/archive/2007/04/07/109052.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Fri, 06 Apr 2007 19:37:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2007/04/07/109052.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/109052.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2007/04/07/109052.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/109052.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/109052.html</trackback:ping><description><![CDATA[条码显示，在birt中最常见的有两种方法：1、使用条码字体（对pdf无效）；2、用barcode的开源包，生成barcode，然后在报表里用动态地址去取图片。<br /><br />今晚看birt文档（第 23 章 使用 Java 编写事件处理程序），例子中用java实现了一个LabelEventAdapter的适配器，对标签元素进行事件控制。脑子里灵光一现，似乎条码有着落了。<br /><br />我的测试例子很简单，继承ImageEventAdapter类，重载onCreate方法，以进行条形码处理<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> cn.ynzc.common.birt.test;<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.io.File;<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.io.FileOutputStream;<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> jbarcodebean.Code128;<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> jbarcodebean.JBarcodeBean;<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.apache.commons.codec.digest.DigestUtils;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.eclipse.birt.report.engine.api.script.IReportContext;<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.eclipse.birt.report.engine.api.script.eventadapter.ImageEventAdapter;<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.eclipse.birt.report.engine.api.script.instance.IImageInstance;<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> MyLabelClass </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> ImageEventAdapter {<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> onCreate(IImageInstance image, IReportContext reportContext) {<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">实际应用中，可以使用image.getRowData().getColumnValue("columnname")获得字段值</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">      String code </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">ABCDEF123-2222</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">似乎windows文件名中不允许使用“-”等符号，干脆将code进行md5散列处理</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">      File file </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> File(System.getProperty(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">java.io.tmpdir</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">), DigestUtils.md5Hex(code));<br /></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">避免每次都进行条码文件生成</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">file.exists()) {<br /></span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">        JBarcodeBean bb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> JBarcodeBean();<br /></span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 0, 0);">        bb.setCodeType(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Code128());<br /></span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);">        bb.setShowText(</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">        bb.setBarcodeHeight(</span><span style="color: rgb(0, 0, 0);">45</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">条码高度</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        bb.setCode(code);<br /></span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">        bb.gifEncode(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> FileOutputStream(file));<br /></span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 0, 0);">      }<br /></span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 0, 0);">      image.setFile(file.getAbsolutePath());<br /></span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">33</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (Exception e) {<br /></span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);">      e.printStackTrace();<br /></span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 0, 0);">  }<br /></span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">38</span> <span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 0, 0);"></span></div><br />测试用的birt报表文件简单得要死，就往上面扔了个image元素，设置其Event Handler Class为刚才写好的java类，最终得到的rptdesign文件内容如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8"</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> Written by Eclipse BIRT 2.0 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">report </span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.eclipse.org/birt/2005/design"</span><span style="color: rgb(255, 0, 0);"> version</span><span style="color: rgb(0, 0, 255);">="3.2.6"</span><span style="color: rgb(255, 0, 0);"> id</span><span style="color: rgb(0, 0, 255);">="1"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="createdBy"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Eclipse BIRT Designer Version 2.1.2.v20070205-1728 Build </span><span style="color: rgb(255, 0, 0);">&amp;lt;</span><span style="color: rgb(0, 0, 0);">20070205-1728&gt;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="units"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">in</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">page-setup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">simple-master-page </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Simple MasterPage"</span><span style="color: rgb(255, 0, 0);"> id</span><span style="color: rgb(0, 0, 255);">="2"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">page-setup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">image </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="4"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="eventHandlerClass"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">cn.ynzc.common.birt.test.MyLabelClass</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">image</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">report</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />运行测试，条形码出来了<br /><div align="center"><img src="http://www.blogjava.net/images/blogjava_net/mmwy/birt.jpg" alt="birt.jpg" border="0" height="407" width="601" /><br /><div align="left"><br />遗留问题：<br />这次是调用org.eclipse.birt.report.engine.api.script.instance.IImageInstance.setFile()来解决问题，从javadoc可以看到，IImageInstance有很多方法可以调用，其它方法分别有什么作用？比如我尝试了半天的setData(byte[])方法，一开始以为是用这个方法直接把图形数据set进去就ok，结果未成功。<br /><br /><br /></div></div><img src ="http://www.blogjava.net/mmwy/aggbug/109052.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2007-04-07 03:37 <a href="http://www.blogjava.net/mmwy/archive/2007/04/07/109052.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用birt2.1.2的IRunAndRenderTask.addScriptableJavaObject在birt中调用spring bea</title><link>http://www.blogjava.net/mmwy/archive/2007/04/06/108955.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Fri, 06 Apr 2007 07:39:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2007/04/06/108955.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/108955.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2007/04/06/108955.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/108955.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/108955.html</trackback:ping><description><![CDATA[birt的IRunAndRenderTask接口提供了<code><strong>addScriptableJavaObject</strong>(java.lang.String jsName,  java.lang.Object obj)</code>方法，利用这个方法，在直接调用birt api操作处理报表的时候，我们可以将任何java对象通过<code>addScriptableJavaObject("xxx",Object)加进birt去，然后在birt脚本中直接调用xxx.method()进行操作。<br /><br />我的测试是在一个webwork+spring+hibernate的webapp应用中进行的，进行报表处理的代码参照<a href="http://wiki.eclipse.org/index.php/Servlet_Example" title="http://wiki.eclipse.org/index.php/Servlet_Example" target="_blank">http://wiki.eclipse.org/index.php/Servlet_Example</a>编写，在代码中，写了一句</code><code><strong>task.addScriptableJavaObject("ctx",</strong></code><code><br />    WebApplicationContextUtils.getWebApplicationContext(sc));<br /><br />birt中定义了一个scripts datasource，然后定义一个data set，在dataset的open方法中编写脚本<br /><br />infoManager=ctx.getBean("infoManager");<br />infos=infoManager.loadAll();<br />...</code><img src ="http://www.blogjava.net/mmwy/aggbug/108955.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2007-04-06 15:39 <a href="http://www.blogjava.net/mmwy/archive/2007/04/06/108955.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>win2003上iis与tomcat的整合</title><link>http://www.blogjava.net/mmwy/archive/2007/03/19/104743.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Mon, 19 Mar 2007 07:39:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2007/03/19/104743.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/104743.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2007/03/19/104743.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/104743.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/104743.html</trackback:ping><description><![CDATA[在apache网站上已经有很详细的介绍<br />http://tomcat.apache.org/connectors-doc/reference/iis.html<br /><br />有几点注意的：<br />1、除了照文档的例子在注册表<b>"HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0"</b>建相应键值外，还可以在<b>isapi_redirect.dll</b>所在的目录建<b>“isapi_redirect.properties”</b>文件。<br /><br />2、extension_uri=/jakarta/isapi_redirect.dll<br />这个extension_uri写成什么路径，就得在iis站点中建相应名字的虚拟目录（执行权限），以保证/jakarta/isapi_redirect.dll能被正常访问到。<br /><br />3、除文档上介绍的几大步（注册表、网站、虚拟路径等）以外，win2003 iis上还得做下面这个步骤<br /><br /><strong>新建应用程序扩展</strong><br />在IIS管理器左侧网站下面选中Web服务扩展，添加一个新的Web服务扩展，扩展名为jakarta,添加要求得文件为D:\Tomcat5.0\bin\jakart\isapi_redirect.dll,并设置扩展状态为允许。<br />（注：来自 <a title="http://www.cnrui.cn/blog/article.asp?id=179" href="http://www.cnrui.cn/blog/article.asp?id=179">http://www.cnrui.cn/blog/article.asp?id=179</a> ）<br /><br /><br /><br /><br /><img src ="http://www.blogjava.net/mmwy/aggbug/104743.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2007-03-19 15:39 <a href="http://www.blogjava.net/mmwy/archive/2007/03/19/104743.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Birt 2.1.1中table row背景颜色交替显示</title><link>http://www.blogjava.net/mmwy/archive/2006/11/24/83150.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Thu, 23 Nov 2006 17:04:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2006/11/24/83150.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/83150.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2006/11/24/83150.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/83150.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/83150.html</trackback:ping><description><![CDATA[
		<br />
		<br />
		<span class="tpc_content">选中table的detail行，切换到script标签，在onPrepare事件中输入<br /><div style="font-size: 9px; margin-left: 5px;"> </div><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 0);">count</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;</span></div><br />在onCreate事件中输入<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; height: 48px; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 128, 128);">1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 0);">count</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">2</span><span style="color: rgb(0, 0, 0);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.getStyle().backgroundColor</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">(count</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">red</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">blue</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span></div><br />或是直接打开xml source，在相应的detail位置上修改源码为<br /><div style="font-size: 9px; margin-left: 5px;"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 0);">                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">detail</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">row </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="66"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    <img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">method </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="onPrepare"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 255);">&lt;![CDATA[</span><span style="color: rgb(128, 128, 128);">count=1;</span><span style="color: rgb(0, 0, 255);">]]&gt;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">method</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">method </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="onCreate"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 255);">&lt;![CDATA[</span><span style="color: rgb(128, 128, 128);">count++;this.getStyle().backgroundColor=(count%2==0?"red":"blue");</span><span style="color: rgb(0, 0, 255);">]]&gt;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">method</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                    <img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />..</span></div></div></span>
		<br />
		<p align="center">
				<img alt="xxxxx.jpg" src="http://www.blogjava.net/images/blogjava_net/mmwy/xxxxx.jpg" border="0" height="252" width="598" />
		</p>
<img src ="http://www.blogjava.net/mmwy/aggbug/83150.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2006-11-24 01:04 <a href="http://www.blogjava.net/mmwy/archive/2006/11/24/83150.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Birt 2.1.1 DataSet利用报表参数动态查询</title><link>http://www.blogjava.net/mmwy/archive/2006/11/23/82924.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Wed, 22 Nov 2006 17:48:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2006/11/23/82924.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/82924.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2006/11/23/82924.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/82924.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/82924.html</trackback:ping><description><![CDATA[
		<strong>定义报表参数：<br /></strong>
		<br />
		<p align="center">
				<img alt="3.jpg" src="http://www.blogjava.net/images/blogjava_net/mmwy/3.jpg" border="0" height="202" width="433" />
		</p>
		<br />
		<br />
		<strong>解决方法一：<br /></strong>
		<br />
		<p align="center">
				<img alt="1.jpg" src="http://www.blogjava.net/images/blogjava_net/mmwy/1.jpg" border="0" height="311" width="598" />
		</p>
		<br />
		<p align="center">
				<img alt="2.jpg" src="http://www.blogjava.net/images/blogjava_net/mmwy/2.jpg" border="0" height="403" width="795" />
		</p>
		<br />
		<br />
		<strong>解决办法二：<br /></strong>
		<br />在报表空白处点击一下，然后切换到script标签，选择beforeFactory。<br /><p align="center"><img alt="4.jpg" src="http://www.blogjava.net/images/blogjava_net/mmwy/4.jpg" border="0" height="168" width="576" /></p><br /><img src ="http://www.blogjava.net/mmwy/aggbug/82924.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2006-11-23 01:48 <a href="http://www.blogjava.net/mmwy/archive/2006/11/23/82924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hibernate.hbm2ddl.auto与import.sql</title><link>http://www.blogjava.net/mmwy/archive/2006/10/31/78187.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Mon, 30 Oct 2006 16:32:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2006/10/31/78187.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/78187.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2006/10/31/78187.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/78187.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/78187.html</trackback:ping><description><![CDATA[笔记一下：<br /><br />设hibernate.hbm2ddl.auto为update/create-drop/create后，在classpath中扔一个/import.sql进去，hibernate启动时就会执行import.sql的内容。<br /><br />11860 [main] INFO  org.hibernate.tool.hbm2ddl.SchemaExport  - Running hbm2ddl schema export<br />11860 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport  - import file not found: /import.sql<br />11875 [main] INFO  org.hibernate.tool.hbm2ddl.SchemaExport  - exporting generated schema to database<br /><img src ="http://www.blogjava.net/mmwy/aggbug/78187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2006-10-31 00:32 <a href="http://www.blogjava.net/mmwy/archive/2006/10/31/78187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>笔记：20061015在CentOS4.3上搭建PHP服务器环境（GD、libmcrypt、mysql、Oracle10g支持）</title><link>http://www.blogjava.net/mmwy/archive/2006/10/15/75207.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Sat, 14 Oct 2006 18:46:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2006/10/15/75207.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/75207.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2006/10/15/75207.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/75207.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/75207.html</trackback:ping><description><![CDATA[
		<b>使用的安装包：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">cronolog-</span><span style="color: rgb(0, 0, 0);">1.6.2</span><span style="color: rgb(0, 0, 0);">.tar.gz                              <br /></span><span style="color: rgb(0, 128, 128);"> 2</span><span style="color: rgb(0, 0, 0);">httpd-</span><span style="color: rgb(0, 0, 0);">2.0.59</span><span style="color: rgb(0, 0, 0);">.tar.gz                                <br /></span><span style="color: rgb(0, 128, 128);"> 3</span><span style="color: rgb(0, 0, 0);">instantclient-basic-linux32-</span><span style="color: rgb(0, 0, 0);">10.2.0.2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">20060331</span><span style="color: rgb(0, 0, 0);">.zip  <br /></span><span style="color: rgb(0, 128, 128);"> 4</span><span style="color: rgb(0, 0, 0);">instantclient-sdk-linux32-</span><span style="color: rgb(0, 0, 0);">10.2.0.2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">20060331</span><span style="color: rgb(0, 0, 0);">.zip    <br /></span><span style="color: rgb(0, 128, 128);"> 5</span><span style="color: rgb(0, 0, 0);">libmcrypt-</span><span style="color: rgb(0, 0, 0);">2.5.7</span><span style="color: rgb(0, 0, 0);">.tar.gz                             <br /></span><span style="color: rgb(0, 128, 128);"> 6</span><span style="color: rgb(0, 0, 0);">mhash-</span><span style="color: rgb(0, 0, 0);">0.9.7.1</span><span style="color: rgb(0, 0, 0);">.tar.gz                               <br /></span><span style="color: rgb(0, 128, 128);"> 7</span><span style="color: rgb(0, 0, 0);">mysql-</span><span style="color: rgb(0, 0, 0);">3.23.58</span><span style="color: rgb(0, 0, 0);">.tar.gz                               <br /></span><span style="color: rgb(0, 128, 128);"> 8</span><span style="color: rgb(0, 0, 0);">php-</span><span style="color: rgb(0, 0, 0);">4.4.4</span><span style="color: rgb(0, 0, 0);">.tar.gz     </span><span style="color: rgb(0, 0, 0);"></span></div></b>
		<b>
				<br />参考文档</b>：<br /><ol><li><a href="http://www.oracle.com/technology/global/cn/pub/notes/technote_php_instant.html">为 Linux 和 Windows 安装 PHP 和 Oracle 10g Instant Client</a></li><li><a href="http://www.akadia.com/services/ora_php_linux.html">Connecting to Oracle10g from PHP using OCI-8 (Linux)</a></li></ol><b>与文档有出处的地方</b>：<br /><ol><li>otn上只能下到zip格式的oracle 10g instant client basic和sdk包。解压缩后，全部放到instantclient_10_2目录下。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">root@localhost sdk</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"># ls -l ..<br />total </span><span style="color: rgb(0, 0, 0);">115948</span><span style="color: rgb(0, 0, 0);"><br />-r--r--r--  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">1594191</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> classes12.jar<br />-rwxrwxr-x  </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> root root </span><span style="color: rgb(0, 0, 0);">18774535</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libclntsh.so<br />-rwxrwxr-x  </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> root root </span><span style="color: rgb(0, 0, 0);">18774535</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libclntsh.so</span><span style="color: rgb(0, 0, 0);">.10.1</span><span style="color: rgb(0, 0, 0);"><br />-r-xr-xr-x  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">5623929</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libnnz10.so<br />-rwxrwxr-x  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">1398088</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libocci.so</span><span style="color: rgb(0, 0, 0);">.10.1</span><span style="color: rgb(0, 0, 0);"><br />-rwxrwxr-x  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root </span><span style="color: rgb(0, 0, 0);">70690282</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libociei.so<br />-r-xr-xr-x  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">119919</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> libocijdbc10.so<br />-r--r--r--  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root  </span><span style="color: rgb(0, 0, 0);">1540457</span><span style="color: rgb(0, 0, 0);"> Feb  </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">2006</span><span style="color: rgb(0, 0, 0);"> ojdbc14.jar<br />drwxr-xr-x  </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"> root root     </span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">04</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">27</span><span style="color: rgb(0, 0, 0);"> sdk<br /></span><span style="color: rgb(128, 0, 0); font-weight: bold;">[</span><span style="color: rgb(128, 0, 0);">root@localhost sdk</span><span style="color: rgb(128, 0, 0); font-weight: bold;">]</span><span style="color: rgb(0, 0, 0);"># ls -l<br />total </span><span style="color: rgb(0, 0, 0);">324</span><span style="color: rgb(0, 0, 0);"><br />drwxr-xr-x  </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">04</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">27</span><span style="color: rgb(0, 0, 0);"> demo<br />drwxr-xr-x  </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> root root   </span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">04</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">27</span><span style="color: rgb(0, 0, 0);"> include<br />-r-xr-xr-x  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root    </span><span style="color: rgb(0, 0, 0);">346</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">04</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">27</span><span style="color: rgb(0, 0, 0);"> ott<br />-rw-r--r--  </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> root root </span><span style="color: rgb(0, 0, 0);">298274</span><span style="color: rgb(0, 0, 0);"> Oct </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">04</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">27</span><span style="color: rgb(0, 0, 0);"> ottclasses.zip</span></div></li><li><span style="color: rgb(0, 0, 0);">php4.4.4已经提供了--with-oci8-instant-client参数的支持，同时修复了相关补丁，因此，文档中为php打补丁、重建</span>“configure”脚本的步骤可以省略。</li></ol><b>环境变量</b>:<br /><ol><li>在LD_LIBRARY_PATH中添加<span style="color: rgb(0, 0, 0);">oracle 10g instant client的路径。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">export LD_LIBRARY_PATH</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/instantclient_10_2/:${LD_LIBRARY_PATH}</span></div></span></li><li><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">设置TNS_ADMIN为oracle tnsname.ora文件所在目录。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">export TNS_ADMIN</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/u01/app/oracle/product/10g/network/admin/</span></div></span></span></li></ol><b>编译脚本</b>：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">./configure \<br />--prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/php-</span><span style="color: rgb(0, 0, 0);">4.4.4</span><span style="color: rgb(0, 0, 0);"> \<br />--with-apxs2</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/httpd-</span><span style="color: rgb(0, 0, 0);">2.0.59</span><span style="color: rgb(0, 0, 0);">/bin/apxs \<br />--with-mysql</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/mysql-</span><span style="color: rgb(0, 0, 0);">3.23.58</span><span style="color: rgb(0, 0, 0);"> \<br />--with-mcrypt</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/libmcrypt-</span><span style="color: rgb(0, 0, 0);">2.5.7</span><span style="color: rgb(0, 0, 0);"> \<br />--with-mhash</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/mhash-</span><span style="color: rgb(0, 0, 0);">0.9.7.1</span><span style="color: rgb(0, 0, 0);"> \<br />--with-gd --with-zlib \<br />--with-oci8-instant-client</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">/www/server/instantclient_10_2<br /></span></div>注：需要使用ln命令为libclntsh.so.10.1创建一个名为<b>libclntsh.so</b>的连接，否则在configure过程中将会出现error:Link xxxx not found的错误。（<a href="http://forums.oracle.com/forums/thread.jspa?messageID=1203218">http://forums.oracle.com/forums/thread.jspa?messageID=1203218&amp;#1203218</a>）<br /><br /><b>测试</b>：<br /><ol><li>安装成功的话，在phpinfo()信息中可以看到相应信息<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">OCI8 Support                  enabled<br />Revision                      $Revision: </span><span style="color: rgb(0, 0, 0);">1.183.2.18.2.3</span><span style="color: rgb(0, 0, 0);"> $<br />Oracle Version                </span><span style="color: rgb(0, 0, 0);">10.1</span><span style="color: rgb(0, 0, 0);"><br />Compile-time ORACLE_HOME      /www/server/instantclient_10_2<br />Libraries Used                no value</span></div></li><li><span style="color: rgb(0, 0, 0);">测试代码<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php <br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 0, 128);">$conn</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> OCILogon(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">username</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">password</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">//127.0.0.1:1521/sid</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">select table_name from user_tables</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(128, 0, 128);">$stid</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> OCIParse(</span><span style="color: rgb(128, 0, 128);">$conn</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">OCIExecute(</span><span style="color: rgb(128, 0, 128);">$stid</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> OCI_DEFAULT);<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$succ</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> OCIFetchInto(</span><span style="color: rgb(128, 0, 128);">$stid</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$row</span><span style="color: rgb(0, 0, 0);">)) {<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$row</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$item</span><span style="color: rgb(0, 0, 0);">) {<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$item</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">        }<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&lt;br&gt;\n</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"> }<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">OCILogoff(</span><span style="color: rgb(128, 0, 128);">$conn</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">?&gt;</span></div><br /></span></li></ol><br /><img src ="http://www.blogjava.net/mmwy/aggbug/75207.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2006-10-15 02:46 <a href="http://www.blogjava.net/mmwy/archive/2006/10/15/75207.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql 3.23.58 charset设置对blob字段操作的影响</title><link>http://www.blogjava.net/mmwy/archive/2006/10/12/74800.html</link><dc:creator>mmwy</dc:creator><author>mmwy</author><pubDate>Thu, 12 Oct 2006 07:54:00 GMT</pubDate><guid>http://www.blogjava.net/mmwy/archive/2006/10/12/74800.html</guid><wfw:comment>http://www.blogjava.net/mmwy/comments/74800.html</wfw:comment><comments>http://www.blogjava.net/mmwy/archive/2006/10/12/74800.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/mmwy/comments/commentRss/74800.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mmwy/services/trackbacks/74800.html</trackback:ping><description><![CDATA[最近在“玩”hibernate Annotation，弄了个Attachment保存进数据库的测试，附件内容保存在content属性里面。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">  @Lob<br />  @Column(columnDefinition </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">LongBlob</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br />  </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] getContent() {<br />    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> content;<br />  }</span></div>一开始，配置mysql jdbc url如下<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">jdbc.url            </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">    jdbc:mysql://localhost/test\<br />                            ?useUnicode</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">true\<br />                            &amp;characterEncoding</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">gbk</span><span style="color: rgb(0, 0, 0);"></span></div>一测试，报错<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">Caused by: java.sql.BatchUpdateException: Syntax error or access violation message from server: </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">You have an error in your SQL syntax near ''D0CF11E0A1B11AE1000000000000000000000000000000003E000300FEFF0900060000000000000' at line 1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br />    at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:</span><span style="color: rgb(0, 0, 0);">1540</span><span style="color: rgb(0, 0, 0);">)</span></div>同样的语句，直接在mysql命令行下运行就没问题，偏偏jdbc上就有这臭毛病。换jdbc driver版本，改@Lob为 @Type(type = "org.springframework.orm.hibernate3.support.BlobByteArrayType")，改hibernate配置（比如hibernate.jdbc.use_streams_for_binary true），甚至是直接用jdbc来insert，乱七八糟折腾半天，问题照旧。最后只好用上“歪”招，把byte[]配成String，在保存的时候把byte[]保存成hex String格式，取的时候再解码回来。<br /><br />歪招终归是歪招，这两天老为这东西心烦，晚上吃饭的时候无意中想起charset的问题，把代码捡回来再测试了一下，问题解决，哈哈！<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">jdbc.url            </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">    jdbc:mysql://localhost/mmwy_blog\<br />                            ?useUnicode</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">true\<br />                            &amp;characterEncoding</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">utf-</span><span style="color: rgb(0, 0, 0);">8</span></div>如果设成iso-8859-1、utf-8,保存一点问题都没有，换用gbk、gb2312、big5之类的字符集，问题就出来了。<br /><br /><img src ="http://www.blogjava.net/mmwy/aggbug/74800.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mmwy/" target="_blank">mmwy</a> 2006-10-12 15:54 <a href="http://www.blogjava.net/mmwy/archive/2006/10/12/74800.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>