Ok Here the Solution to connect MYSQL with JSP above given program. I asked about to my boss, he is a real expert…
First open Netbeans
Click on SERVICES
then Right Click on the server like for me its “Apache Tomcat” then select Edit Server.XML
Add below Line at line 39 i think between GlobalNamingResources tags
<Resource name="jdbc/DATABASENAME" type="javax.sql.DataSource" maxActive="4" maxIdle="2" username="root" password="" maxWait="23000" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/DATABASENAME"></Resource>
and Save it
Now select Projects
then right Click on the project you are working and select Properties
Now in Libraries Under Compile tab click Add JAR
Then locate your “mysql-connector-java-5.1.18-bin.jar”
then click ok
then restart server
then Its Done !
solved Connection of JSP with MySQL failed