Home > Backend Development > PHP Tutorial > How to connect to mysql database using JSP (1)_PHP tutorial

How to connect to mysql database using JSP (1)_PHP tutorial

WBOY
Release: 2016-07-13 17:03:14
Original
965 people have browsed it



1. Software download
 Mysql
 Download version: 4.1.11
 http://dev.mysql.com/downloads/mysql/4.1.html

 JDBC driver
 Download version: 3.1.8
http://dev.mysql.com/downloads/connector/j/3.1.html Mysql interface plug-in: mysql-front
Download version image: HongKong (the Chinese version will be installed next time)
 http://www.mysqlfront.de/download.html 2. Software installation
1. Install mysql
Please refer to the relevant articles in the information section http://info.mysql.cn/install/2006/0208/81.html 2. JDBC driver: mysql -connector-java-3.1.8
This is just a compressed package and does not need to be installed. Just unzip it. We are using the file in the folder mysql-connector-java-3.1.8: mysql-connector -java-3.1.8-bin.jar. 3. Mysql interface plug-in: mysql-front
This is an installation program, just follow the prompts to install it. Three. Environment configuration
First of all, I want to explain that my current installation path of tomcat is: D:Program FilesJavaTomcat; the installation path of JDK is: D:Program FilesJavaj2sdk. Here, the environment variables that need to be configured are the JDBC drivers. Before configuring, first put the mysql-connector-java-3.1.8-bin.jar mentioned just somewhere on your local hard disk (where I put it: D:Program FilesJavamysqlforjdbc), and then configure the classpath according to where you put it. The configuration is like this: D: Program filesJavaj2sdklib ools.jar; D: Program FilesJavaj2sdklibmysql-connector-java-3.1.8-bin-g.jar; -3.1.8-bin.jar The purpose of configuring this is to allow your java application to find the driver that connects to mysql. After configuring the environment variables, another very important step is to configure the driver for JSP to connect to the database. This is actually very simple, just copy mysql-connector-java-3.1.8-bin.jar to some folder. , I read a lot of information on the Internet and asked a lot of people, and there are various opinions. I summarized it, and I did it all for the sake of insurance. Haha, anyway, it is just copying a 400K file. Now I list the mysql The folder copied into -connector-java-3.1.8-bin.jar is as follows: D: Program FilesJavaTomcatcommonlib
D: Program FilesJavaTomcatsharedlib
4. Use of database After Mysql is installed, there are still some things to pay attention to (reference): http://info.mysql.cn/install/2006/0208/82.html Just like in As mentioned in the article, after MySQL is installed, the most important thing is to check whether the database has been started as a system service. Therefore, before you perform database operations, you should check and enter services at the start of the operating system -> Run -> Enter services. msc, make sure that the mysql service you set during installation has been started, so that you will not get a connection failure error when operating the database. A more convenient mysql interface plug-in is mentioned above, but I only found this interface after I started using mysql. At first, I used the command line to operate it under dos. Although that interface can also be used to create databases, set permissions, etc., I think knowing how to use the command line is also a very important skill, so I will start with the command line and talk about how to use mysql simply. We will talk about the use of mysql-front later. Now I want to build a database shujuku in mysql and a table biao in the database. The specific commands are as follows (assuming that I have just installed mysql) 1. Enter the dos state (remember that the command line must be run in the bin directory under the installation directory of mysql) 2. Connect to mysql

http://www.bkjia.com/PHPjc/630981.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630981.htmlTechArticle1. Software download Mysql download version: 4.1.11 http://dev.mysql.com/downloads/mysql/4.1.html JDBC driver download version: 3.1.8 http://dev.mysql.com/downloads/connector/j/ 3.1.html My...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template