Statement stmnt = null; // statement for category
Statement stmnt2 = null; // statement for book
Statement stmnt3 = null; // statement for thumbnail
ResultSet query = null;
Connection conn = null;
ResultSet getBooks = null;
ResultSet getThumbnail = null;
//InputStream thumbnail = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
}catch (ClassNotFoundException cnf){
System.out.print("Error");
}
try{
conn = DriverManager.getConnection("jdbc:mysql://localhost/ebooks", "root", "thuyhien");
stmnt = (Statement) conn.createStatement();
stmnt2 = (Statement) conn.createStatement();
query = stmnt.executeQuery("Select * from Category");
getBooks = stmnt2.executeQuery("select * from Books");
}catch (SQLException sex){
System.out.println("Unable to connect to database");
}
Wednesday, June 30, 2010
Tuesday, June 29, 2010
Change Max size Upload for PHPMyAdmin
Step 1: Go to the directory: "/etc/php5/apache2", open the php.ini and search for "upload_max_filesize", then change to 512M, 1024M, 2048M...etc... Moreover, search for "memory_limit" and change it into 512M.
Step 2: Go to the directory: "/etc/mysql", open my.cnf and change "max_allowed_packet" from 16M into 32M
Step 3: Reboot the system.
Step 2: Go to the directory: "/etc/mysql", open my.cnf and change "max_allowed_packet" from 16M into 32M
Step 3: Reboot the system.
Install Apache Tomcat 6.0 in Linux Environment
System: Mint Linux 8.0
Step 1: Download the installation file from http://tomcat.apache.org/tomcat-6.0-doc/index.html
Step 2: Extract the installation file, (if you want to use terminal in linux, here is the command: "tar xvzf apache-tomcat-6.0.14.tar.gz")
Step 3: move to the extracted folder to "/usr/local/tomcat"( Linux Command: sudo mv apache-tomcat-6.0.14 /usr/local/tomcat)
Step 4(optional): If you want the Tomcat server start automatically when your computer boots up, just follow the below instructions:
. go to the directory "/etc/init.d/tomcat' and create the file named "tomcat"
. Copy and paste the following bash script:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
Step 5: Link this script to the startup folder by using these command:
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Step 6: Reboot or logout your computer. If the server doesn't start automatically, open the terminal and execute the command: "sudo service tomcat start"
Note: If you want to stop your server, (trust me, you have to do this if you use Eclipse IDE) use the command in terminal: "sudo service tomcat stop".
After following those steps, you install Apache Tomcat Server successfully.
Good luck
Step 1: Download the installation file from http://tomcat.apache.org/tomcat-6.0-doc/index.html
Step 2: Extract the installation file, (if you want to use terminal in linux, here is the command: "tar xvzf apache-tomcat-6.0.14.tar.gz")
Step 3: move to the extracted folder to "/usr/local/tomcat"( Linux Command: sudo mv apache-tomcat-6.0.14 /usr/local/tomcat)
Step 4(optional): If you want the Tomcat server start automatically when your computer boots up, just follow the below instructions:
. go to the directory "/etc/init.d/tomcat' and create the file named "tomcat"
. Copy and paste the following bash script:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
Step 5: Link this script to the startup folder by using these command:
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Step 6: Reboot or logout your computer. If the server doesn't start automatically, open the terminal and execute the command: "sudo service tomcat start"
Note: If you want to stop your server, (trust me, you have to do this if you use Eclipse IDE) use the command in terminal: "sudo service tomcat stop".
After following those steps, you install Apache Tomcat Server successfully.
Good luck
Saturday, May 22, 2010
Setup java Servlets with Eclispe
this is the best tutorial of Setup java Servlets with Eclispe
http://www.vogella.de/articles/EclipseWTP/article.html
http://www.vogella.de/articles/EclipseWTP/article.html
Subscribe to:
Posts (Atom)