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.
Monday, September 29, 2008
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 http://jp-javaprogrammer.blogspot.com
<html>
<head>
<meta equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta equiv="REFRESH" content="0; URL=http://jp-javaprogrammer.blogspot.com/">
<title>JP</title>
</head>
</html>
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.
For example the following code written in home.html. Whenever you clicked on this home.html link, browser will take you to http://jp-javaprogrammer.blogspot.com
<html>
<head>
<meta equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta equiv="REFRESH" content="0; URL=http://jp-javaprogrammer.blogspot.com/">
<title>JP</title>
</head>
</html>
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.
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 custom_script.sh.
custom_script.sh code:
cp /home/Example.java /home/Example_copy.java
In this script just i am copying a file to another.
The java code to call that script.
import java.io.BufferedWriter;
import java.io.*;
public class CallScript
{
public static void main(String s[]) throws Exception{
Runtime rt = Runtime.getRuntime();
try {
String str = "/absolute_path/test.sh";
Process child = rt.exec("/bin/bash");
BufferedWriter outCommand = new BufferedWriter(new Output
StreamWriter(child.getOutputStream()));
outCommand.write(str +"\n");
outCommand.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}
I have written a script called custom_script.sh.
custom_script.sh code:
cp /home/Example.java /home/Example_copy.java
In this script just i am copying a file to another.
The java code to call that script.
import java.io.BufferedWriter;
import java.io.*;
public class CallScript
{
public static void main(String s[]) throws Exception{
Runtime rt = Runtime.getRuntime();
try {
String str = "/absolute_path/test.sh";
Process child = rt.exec("/bin/bash");
BufferedWriter outCommand = new BufferedWriter(new Output
StreamWriter(child.getOutputStream()));
outCommand.write(str +"\n");
outCommand.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Subscribe to:
Posts (Atom)