Detailed steps of using JDBC to connect to MySQL database in JSP

1. First enter the name of Web project in the new project text box, and then click next.

2. Click next to continue

3. Put the generate web Check the XML deployment descriptor check box.

4. Click Finish to complete the creation of the web project project.

5. Open MyEclipse datebase explore, as shown in the figure

6. Fill in the contents as shown in the figure, and add the corresponding database driver through add jars.

7. To test whether the driver is connected successfully through test driver, you need to enter a password. After success, it is shown in the figure below

8. Click Finish to complete the database connection, right-click to select open database connection, enter the password, and click OK

9. Next, you need to add the MySQL database driver in the created directory. You need to paste the corresponding MySQL database driver into the WEB-INF / lib folder.

10. Right click mysql-connector-java-5.1 6. Jar, click Add to build path in build path

11, in index JSP, and configure the corresponding MySQL database data

12. The operation is successful. If the 8080 port number is occupied, the following method can be used to delete the corresponding process.

At the command prompt, enter netstat - AON | findstr 8080

Find the PID of the corresponding process, assuming 7659, and then enter the following command

taskkill /pid 7659 /F

You can delete the corresponding process.

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>