Friday, April 01, 2005

jTDS JDBC driver

I was using MS jdbc driver for hibernate and encountered an "cannot re-read" error when performing query. Google it, found it is a microsoft bug. Recommended jdbc driver is jTDS, the most performanced one. The company just contribute it to SourceForge.

NOTE: setting in the jdbc, example

jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://hchen:1433;DatabaseName=SGMDB
I was using MS jdbc driver for hibernate and encountered an "cannot re-read" error when performing query. Google it, found it is a microsoft bug. Recommended jdbc driver is jTDS, the most performanced one. The company just contribute it to SourceForge.

NOTE: setting in the jdbc, example

jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://hchen:1433;DatabaseName=SGMDB

Tuesday, March 29, 2005

Log4j.properties

To run tomcat in Eclipse enviroment, the Log4j.properties file has to be put under the /WEB-INF/classes folder directly. Have a classpath pointed to the file in eclipse has no use.

Thursday, March 24, 2005

Name based Virtual host on IIS6

To do this, we need:

1. Create a new website with the wizard.
2. When asked for an IP address, specify one that is already being used by other website, say www.domain.com.
3 When asked for the host header, enter the www.domain2.com of the site.

Now we can have both www.domain.com and www.domain2.com accessed at the same ip address.
Note: The key is the "host header". It can be changed by clicking on "Advanced" to the right of the IP address.

Tuesday, March 22, 2005

Character Encoding in Tapestry

I need to output CHinese on webpage and gb2312 is required. I was testing for a night and didn't find a way to do this untill I saw this post on mailinglist.

In short, should add something like this:



to the .application file or to the relevant .page files and the templateswould use the UTF-8 encoding.

and then extends BasePage like this:

public IMarkupWriter getResponseWriter(OutputStream out) {
HTMLWriter writer = new HTMLWriter("text/html; charset=GB2312",
out);
//getPage().getEngine().setLocale(Locale.CHINESE);
return writer;
}

Reference:
Encoding

Recover SVN

When accessing SVN, froze and no response. Shutdown the service didn't help. Do this:

1. Shutdown apache2, svnserver.
2. svnadmin recover REPOS_PATH
3. Finally if you don't change the permission of REPOS_PAH/db to apache:apache. You got the following:

svn: Berkeley DB error while opening environment for filesystem /var/svn/buzzsponge-dev/db:
Permission denied

MSSQL install

I was struggling for a whole day to get MS SQL DEV installed on my machine. The processes were run but with no reponse. After shutdown the services one by one, finally got the source of the problem. It is caused by an IBM service QCTray. After terminating this service, the installer ran successfully.

Reverse DNS

I knew today that if the mailserver don't have reserse DNS resolve for ip address. Most ISP will refuse the emails sent by it. My server is of this kind.

Monday, March 21, 2005

SQL server problem

I installed/reinstalled MSSQl 2000 developer Edition for 3 times with the following error every time.

Encountered an unexpected error while checking the sector size for file 'd:\Microsoft SQL Server\MSSQL\data\tempdb.mdf'.

Finally found the problem is the permission. System and administrators should be assigned to the installation folder with full access permission. MS explains here.

Uninstalling MSSQL

appwiz.cpl failed to use uninstall MSSQL. Have to do it manually. Besides all the files under the installation folder. We also need to delete some entries in registry:


1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
2. HKEY_LOCAL_MACHINES\System\CurrentControlSet\Services\MSDTC