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] Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException
- How to Solve JDBC connection error in spring MVC integration
- [Solved] org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession…
- [Solved] springboot Project Run Error: HikariPool-1 – Exception during pool initialization.
- How to Solve c3p0 error (Cause & Solution)
- Error querying database.Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource.
- [Solved] java.sql.SQLException: Unknown system variable cache query size
- Public Key Retrieval is not allowed [How to Solve]
- Mybatis reports an error (error building sqlsession.) when using annotations without deleting redundant files
- [Solved] mybatis Error querying database. Cause: java.sql.SQLException: The server time zone value
- Java database Druid error: com.alibaba.druid.pool.DruidDataSource error
- [Solved] Springboot Error: Error creating bean with name ‘dataSource‘ defined in class path resource
- [Solved] java.sql.SQLException: Unsupported character encoding ‘utf-8
- [Solved] Error creating bean with name ‘accountService‘: Unsatisfied dependency expressed through field
- [Solved] mybatis plus Insert Error: mybatis plus Error setting null for parameter #1 with JdbcType OTHER
- Springboot uses Oracle database to report property ‘sqlsessionfactory’ or ‘sqlsessiontemplate’ are required
- [Solved] init datasource error, url: jdbc:mysql://localhost:3306/test
- How to Solve Error: No suitable driver found for
- [Solved] Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find cla
- Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource