: http://dev.mysql.com/downloads/connector/j/
Install Mysql-connector-java-5.1.38.zip:
1. Unzip the file-"Copy the Mysql-connector-java-5.1.38-bin.jar file inside the-" E:\Tomcat\lib
2. Right-click Web Project-"properties-" libraries-"Add External jars-" Mysql-connector-java-5.1.38-bin.jar Add in-"finish
To check if the installation was successful:
<%@ Page Language="Java"Import="java.util.*"pageencoding="UTF-8"%><% StringPath=Request.getcontextpath (); StringBasePath=Request.getscheme ()+ "://" +Request.getservername ()+ ":" +Request.getserverport ()+Path+ "/";%><%@ Page Import="java.sql.*" %><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"><HTML><Head><Basehref= "<%=basePath%>"><title>My JSP ' testconnection.jsp ' starting page</title></Head><Body> <% //Student for database name, plus UseSSL=true or ErrorStringURL="jdbc:mysql://localhost:3306/student?usessl=true"; StringUsename="Root"; StringPassword="2277092"; Connection Conn=NULL; try{Class.forName ("Com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) {out.print ("An exception occurred loading the drive class"); } try{Conn=NULL; Conn=drivermanager.getconnection (Url,usename,password); } catch (SQLException e) {out.print ("SQL exception occurred during connection to database"); } if(Conn==NULL) {Out.print ("failed to connect to database"); } Else{out.print ("Connection Database Successful"); } try{Conn.close (); } catch (SQLException e) {out.print ("SQL exception occurred while closing database connection"); } %></Body></HTML>
MySQL------How to install Mysql-connector-java-5.1.38.zip