Archive for May 2011

Connection Pool: MySQL connection closed exception

The Problem While using a MySQL connection pool in Java, I received a MySQL Connection Closed Exception (see below). The problem was that the JDBC driver was not compatible to the MySQL server version. I have used version 5.05a for both JDBC and MySQL and it solved the problem The problem is that the connection […]

How To Switch Java in Centos

* If you need to install a new version of java, download the version from java.sun * run /usr/sbin/alternatives to change the default java. If you will run the next command you will see which java versions are available: # /usr/sbin/alternatives –config java There is 1 programs which provide ‘java’. Selection Command ———————————————– *+ 1 […]

Adding DbUnit to your project

About DbUnit DbUnit is a JUnit extension (also usable with Ant) targeted at database-driven projects that, among other things, puts your database into a known state between test runs. This is an excellent way to avoid the myriad of problems that can occur when one test case corrupts the database and causes subsequent tests to […]

How to get directories via FTP

How to GET directories via FTP: You can get a directory files (recursive) by using wget command with flag -m for –mirror wget -m See using wget to recursively download whole ftp directories

How to setup log rotation on Flume

Flume can be used to rotate logs file into a regular file system. Examples: In BE mode (Best Effort) exec config ‘tail("/tmp/error.log")’ ‘agentBESink("",35888)’ exec config ‘collectorSource( 35888 )’ ‘collectorSink("/tmp/nlog/%Y/%m/%d/errorlog", "mylog_%{host}_%H_",60000 )’ in E2E (End to End) exec config ‘tail("/tmp/error.log")’ ‘agentE2ESink("",35888)’ exec config ‘collectorSource( 35888 )’ ‘collector(600000) {collectorSink("/tmp/nloge/%Y/%m/%d/errorlog", "mylog_%{host}_%H_",600000 )}’ Explanations: collectorSink […]

How to use the Flume E2E mode

E2E provides the best reliability mode: You can tune the reliability level of the agents, simply by specifying a different kind of agent sink. There are three levels available. One of them is the E2E (End To End) mode, which relies on an acknowledgement, and will retry if no acknowledgement is received. E2E limitations: E2E […]