When I was self-studying the JavaEE course, when I was doing some small things, I needed to connect to the MySQL database. I read the book and then explored it myself. I succeeded step by step. Learning is also a process of sharing. I combine pictures and texts. I hope it can help more people. people.
1. Configure Database Explorer1.
Open MyEclipse Database.
Method: Window-->Openperspective-->MyEclipse Database Explorer
2. Click MyEclipse in the upper right corner...right-click in the blank space of DB Browser-->new to open DataBase Driver
3. Fill in the content in the opened DataBase Driver and explain what each table represents
template: Driver template, choose different driver types according to the database used, because we are connecting to MySQL, so we choose MySQL Connector/J;
Driver name: The name of the connection;
Connection URL: Set the connection address. In the picture,
User name: usually the default root;
Password: The password of the database, the default is 123456;
Add Jar: Add the jar package of the database and download it yourself;
Driver classname: The system will automatically match;
4.
Test whether your database connection is successful. As long as you follow the above steps, there should be no major problems. After opening, it is the same as in navicat
2. After the DataBase is configured, just import and add the mysql package to the project.
Add the mysql package to the project, follow the order of the pictures, then click next to create a new one, give it a name, and click ok. Add the jar package, import the mysql package into it, and click OK to finish. That’s it.
3. Check whether the jar package has been imported into the project, and then write a java class for the database, and it can be used.
The above is the entire content of this article. I hope it will be helpful to everyone’s study and I hope you will support me a lot.