Connect to MySQL DB

# ubuntu package
sudo apt-get install -y libmysql-java
 
path: /usr/share/java/mysql-connector-java.jar
 
# download
wget http://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-J/mysql-connector-java-5.1.12.tar.gz -P /tmp
 
# extract
tar xzf /tmp/mysql-connector-java-5.1.12.tar.gz -C /tmp/
 
# copy to your classpath
cp /tmp/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar ~/NetBeansProjects/classpath/
 
# Netbeans
add Library / Jar File
select 
~/NetBeansProjects/classpath/mysql-connector-java-5.1.12-bin.jar
 
# create tatabase
create database java;
CREATE USER dbo_java IDENTIFIED BY 'java_test';
grant all on java.* to 'dbo_java'@'%' identified by "java_test"
 
# configure your mysql to allow acces from network
http://www.panticz.de/mysql
 
 
FIX missing driver
cp /usr/share/java/jtds-1.2.5.jar /var/lib/tomcat6/webapps/YOUR_APP/WEB-INF/lib/

Links
http://www.mysql.de/downloads/connector/j/
http://www.kitebird.com/articles/jdbc.html