2009年9月27日 星期日

tomcat5.5 + apache2.2

實踐apache和tomcat的整合,原來這麼簡單.

1:安裝tomcat,jdk,這些就不說了,這個大家應該都會

2:下載apache_2.2.11-win32-x86-no_ssl.msi,這在apache網站上就有,

3:下載mod_jk-1.2.28-httpd-2.2.3.so,這個是apache和tomcat整合必須的,在apache網站上也有,

4:安裝好apache http server後,進入到apache的安裝目錄下, Apache2.2\conf ,在此新建一個workers.properties文件,將以下內容copy到workers.properties文件中
# Defining a worker named worker1 and of type ajp13
worker.list=ajp13w
worker.ajp13w.type=ajp13
worker.ajp13w.host=127.0.0.1
worker.ajp13w.port=8009
worker.ajp13w.lbfactor=1

5: copy mod_jk-1.2.28-httpd-2.2.3.so文件到Apache2.2\modules目錄下,並且改名為mod_jk.so(為了方便)

6:配置Apache2.2\conf目錄下httpd.conf文件,增加以下內容:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkMount /*.jsp ajp13w
JkMount /*.jspx ajp13w
JkMount /servlet/* ajp13w
JkMount /*.servlet ajp13w
JkMount /* ajp13w
上面都配置好之後,啟動tomcat ,啟動apache,輸入http://localhost ,看到tomcat的首頁就ok了

source: http://codestandup.blogspot.com/2009/07/apache-tomcat.html

2009年9月24日 星期四

vsftp 出現500 OOPS: cannot change directory:/home/無法登入

vsftpd 出現500 OOPS: cannot change directory:/home/500 OOPS:
child diedConnection closed by remote host.無法登入,如何解決?

因為安裝時啟用了防火牆 在不關閉的狀況下要
輸入 setsebool ftpd_disable_trans 1

以 root 登入,並下達下面指令後,重新啟動 vsftpd即可。
# setsebool ftpd_disable_trans 1
# /etc/init.d/vsftpd restart


資料來源 : http://itkm.blogspot.com/2008/02/vsftp-500-oops-cannot-change.html

2009年9月23日 星期三

各種資料庫連結方式

odbc及oracle使用
Connection conn=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:dbname","username", "userpassword");

mysql 使用
Connection conn=null;
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection( "jdbc:mysql://hostip:3306/databasename?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"
,"username","userpassword")

SQL2005使用
下載並安裝sqljdbc.jar ,classpath 一定要指定這個jar檔.

Connection conn=null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection( "jdbc:sqlserver://192.168.5.11:1433;DatabaseName=dbname;", "username", "userpassword");

SQL2000使用
Class.forName"com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection m_Connection = DriverManager.getConnection "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MyDatabase", "userid", "password");

file class 路徑指定

linux 中
new File("/var/lib/tomcat5/webapps/ROOT/erp/sop")

windows 中
new File("C:\\var\\lib\\tomcat5\\webapps\\ROOT\\erp\\sop")

RedHat讀Windows字型

1.只要把windows 字型copy 放到 redhat 的/etc/fonts/
2.然後重開機就可以了

2009年9月17日 星期四

iReport 3.6 + Tomcat 6.0使用

1.將 iReport\ireport\modules\ext 下的
jasperreports.* 檔案
eigenbase.* 檔案

複製到

Tomcat\lib 目錄下.

2.將 iReport\ireport\modules\ext 下的
iText-2.1.5.jar 檔案
iTextAsian.jar 檔案
jasperreports-3.6.0.jar 檔案
spring.jar 檔案
groovy-all-1.5.5 檔案

複製到

Tomcat\webapps\ROOT\WEB-INF\lib目錄下.

我是要使用iReport 產生EXCEL表,我的配置這樣就能使用了。

2009年9月16日 星期三

iReport 3.6 PDF 字型安裝

如果iReport 發生下列錯誤,可能是PDF字型沒有裝好
Error exporting print... Could not load the following font

1. 網址 : http://prdownloads.sourceforge.net/itext/iTextAsian.jar 下載 iTextAsian.jar
2. 網址 : http://sourceforge.net/projects/itext/ 下載 iText.jar
2. 將 iText.jar 及 iTextAsian.jar存放至 iReport\ireport\modules\ext 目錄中
3. 打開iReport,進入Tools -> Options內的iReport選項設定
4. 先在Classpath頁,點擊Add JAR,將ireport/modules/ext/iTextAsian.jar 及 iText.jar 列入Classpath清單
5. 完成以上步驟後,才能在Fontpath頁上看到iTextAsian.jar 還有 iText.jar , 勾選它,再重開iReport 就完成了。

資料參考網址:http://blog.cjcht.com/index.php/henry/2009/04/

2009年9月10日 星期四

SQL 2005 Connection timeout 連線逾時處理

DBA’s Quick Guide to Timeouts

by Chris Kempster
The author of: SQL Server 2000 for the Oracle DBA
Click here for more information, sample chapters, or to purchase this e-book.
The application development DBA needs a good understanding of the overarching application architecture and subsequent technologies (COM+, MSMQ, IIS, ASP etc) to more proactively debug and track down database performance problems. A good place to start is common timeout error. This article will provide a brief overview of where to look and how to set the values.

ADO

Within ADO, the developer can set:

connection timeout (default 15 seconds)
if the connection cannot be established within the timeframe specified
command timeout (default 30 seconds)
cancellation of the executing command for the connection if it does not respond within the specified time.

These properties also support a value of zero, representing an indefinite wait.

Here is some example code:

Dim MyConnection as ADODB.Connection

Set MyConnection = New ADODB.Connection

MyConnection.ConnectionTimeout = 30

MyConnection.Open

- and -

Set MyConnection = New ADODB.Connection

<>

MyConnection.Open strMyConn


Set myCommand = New ADODB.Command

Set myCommand.ActiveConnection = MyConnection

myCommand.CommandTimeout = 15

Take care with command timeouts are described by Microsoft:

http://support.microsoft.com/default.aspx?scid=KB;en-us;q188858

文件原文 http://vyaskn.tripod.com/watch_your_timeouts.htm