- Green versionCheck
- Green versionCheck
- Green versionCheck
- Green versionCheck
Installation method:
Install mysql-connector-java-5.1.38.zip:
1. Unzip the file-"Copy the mysql-connector-java-5.1.38-bin.jar file inside to-"E:Tomcatlib
2. Right-click the Web project-》properties-》Libraries-》Add External JARs-》mysql-connector-java-5.1.38-bin.jar and add it-》finish
Use code reference:
If your mysql-connector-java-5.1.13-bin.jar package is placed in the following directory, set the ClassPath and add the following D:Program FilesJavamysqlconnmysql-connector-java-5.1.13-bin.jar; This is how I solved it.
Compare the code. The premise is that you have placed the mysql jar package in your project.
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://127.0.0.1:3306/write database name here";
//Load driver
Class.forName(driver);
// Continuous database
Connection conn = DriverManager.getConnection(url, write username and password here);
How is it handled externally in the IDE?
Have you imported the jar file?
In the IDE, I generally do not set the ClassPath. I directly place the jar package in the current directory or the lib directory in the WEB project, then right-click on the project Properties->Java Build Path->Libraries->add External JARs and find The jar file in the current directory will do.
If you use IDE to develop, just add mysql-connector-java-5.0.5-bin.jar to the Classpath and execute it. If not, you need to write like this when executing (for example, you put it in d: )
java -cp d:mysql-connector-java-5.0.5-bin.jar data
it works
it works
it works