I am using Netbeans IDE 6.8 so the tutorial also based on that software
here we go
Requirements:
Download Connector/J
Must have Mysql database installed
Step 1:
Extract Connector/J and copy "mysql-connector-java-5.1.17-bin.jar" file and paste it in " apache-tomcat-5.5.33\apache-tomcat-5.5.33\common\lib "
NOTE : if you have more than such files in "apache-tomcat-5.5.33" folder than it will clash resulting connection failure
Step 2:
Paste below code to connect
<%
...