When using mybatis to write the entry instance for the first time, I encountered the error of cannot find class: com.mysql.jdbc.driver database property configuration file content:
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/exercise?serverTimezone=GMT%2B8
jdbc.user=root
jdbc.password=1996mysqlyue
Mybatis configuration part:
<!--Four basic information for connecting to the database-->
<dataSource type="POOLED">
<property name="driver" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
</dataSource>
Confirm that there is no space in the quotation marks of the value value in the configuration file, and there is no space in the configuration information of the database property file, but still report an error
subsequent solution:
modified the dependency version of MySQL connector introduced by Maven.
Read More:
- [Solved] Tomcat Server Error: java.lang.NullPointerException Csonsole Error ClassNotFoundException: com.mysql.jdbc.Driver
- [Solved] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure error
- Extracting JDBC tool class: JDBC utils
- [Solved] You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration proper
- [Solved] com.highgo.jdbc.util.PSQLException:bad value for long
- [Solved] init datasource error, url: jdbc:mysql://localhost:3306/test
- [Solved] Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException
- [Solved] Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find cla
- Reason: failed to determine a suitable driver class [Solved]
- [Solved] Spring jdbctemplate Error: ‘Java. SQL. Driver’ for property ‘driver’: no
- How to Solve JDBC connection error in spring MVC integration
- [Solved] AndroidStudio Error: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
- [Solved] Maven Project Packaging Error: Unable to find main class
- Java Running Error: Could not find or load main class
- [Solved] Jenkins Publish to rancher Error: ERROR: Build step failed with exception java.lang.ClassCastException: class com.
- Java error: unable to find or load main class (package name in source file)
- [Solved] Could not find resource COM / atguigu / Dao / studentdao.xm, the mapper file for storing SQL statements could not be found and an error occurred
- Error querying database.Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource.
- Java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver [How to Solve]
- How to Solve Error: No suitable driver found for