MySQL------How to install Mysql-connector-java-5.1.38.zip

Source: Internet
Author: User

: 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.