Monday, September 29, 2008

MySql ERROR 1054

I was breaking my head when i was doing import data from mysqldump in Linux machine. The problem was "ERROR 1054 (42S22) at line 1564: Unknown column 'cust.CUSTOMER_NAME' in 'field list' ". I surfed the net but i couldn't get any stuff.

Then i put this problem on my guru[Mukund]. He explained the problem.

MySql behave as case-in-sensitive in microsoft environment. So while writing function, procedure and trigger case is no issues in microsoft environment. But in case of Linux, MySql behave as case-sensitive. All the development machines were Microsoft Environment. Production environment is Linux.

To fix this problem [To make Linux case insensitive] add the following line in the file /etc/mysql/my.cnf
lower_case_table_name = 1

This line make MySql case-in-sensitive in linux environment.

Tuesday, September 23, 2008

HTML Redirect to new URL

This is very useful when we want redirect from one page/site to other page/site.
For example the following code written in home.html. Whenever you clicked on this home.html link, browser will take you to

<meta equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta equiv="REFRESH" content="0; URL=">

Here http-equiv="REFRESH" tag reload/redirect the page after the mentioned time in the content tag.
Content=0 means immediately redirect /load the page.

Friday, September 19, 2008

Mysql Error : Mysql has gone away.

I had a problem while import database from my server to local around 117MB size. Suddenly i got in a problem. That was "Mysql has gone away". I surfed the net and got the solution.

When mysql server receives packet more than mentioned in max_allowed_packet in mysql server configuration, mysql server throw out the error "Mysql has gone away".

To fix this problem you can change max_allowed_packet value in my.cnf file in linux machine. This file will be in /etc/mysql/my.cnf

max_allowed_packet = 36M

Restart mysql.

Thursday, September 18, 2008

How to Run Unix shell script in java

I came across the scenario wherein i have to call/ Run the unix shell script. I think this would help you guys.

I have written a script called code:

cp /home/ /home/

In this script just i am copying a file to another.

The java code to call that script.

public class CallScript
public static void main(String s[]) throws Exception{
Runtime rt = Runtime.getRuntime();
try {
String str = "/absolute_path/";
Process child = rt.exec("/bin/bash");
BufferedWriter outCommand = new BufferedWriter(new Output
outCommand.write(str +"\n");

} catch (Exception e) {