I am trying to connect to mysql. Below are the jars i am using for this purpose,
1. c3p0-0.9.5.5.jar
2. hibernate-c3p0-5.4.19.Final.jar
3. hibernate-core-5.4.19.Final.jar
4. mysql-connector-java-5.1.44.jar ( have tried with 8.x above version as well)
Below is my .xml content
<session-factory>
<!-- JDBC Database connection settings -->
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/devenv?useSSL=false&serverTimezone=UTC</property>
<property name="connection.username">newuser</property>
<property name="connection.password">newuser12#</property>
<!-- JDBC connection pool settings ... using built-in test pool -->
<property name="connection.pool_size">1</property>
<!-- Select our SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Echo the SQL to stdout -->
<property name="show_sql">true</property>
<!-- Set the current session context -->
<property name="current_session_context_class">thread</property>
</session-factory>
Below is my error message :
[C3P0PooledConnectionPoolManager[identityToken->1hgery9ab1a070yr7e982f|51d673db]-HelperThread-#0]
WARN com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2df67b58
-- Acquisition Attempt Failed!!! Clearing pending acquires.
While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
Last acquisition attempt exception:
java.sql.SQLException: Unknown system variable 'query_cache_size'
at
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
Solution which have tried :
- Tried with sql connector 8.x above and 5.x
- Tried with different sql user
- Tried adding query_cache_type and query_cache_size as a variable in my.ini file. No variable have been created in db after adding entry in my.ini
More info.
I was able to connect to db earlier using sql connector 8.x when I tested jdbc connection. Now i have created a mvc project, while trying now, facing this error.
Need netizens help on this !