Hibernate 5.1.16.Final + MSSQL + Java7 + C3P0

Asked

Viewed 82 times

0

I am successfully using Hibernate to consult a MS SQL database, but I get the message that I should not use in production.

Using Hibernate built-in connection pool (not for production use!)
....
2018-10-23 18:01:40 WARN  ConnectionProviderInitiator:219 - HHH000022: c3p0 properties were encountered, but the c3p0 provider class was not found on the classpath; these properties are going to be ignored.

I chose to use the C3P0 Provider but when I include the property in "Hibernate.cfg.xml"

 <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

get the bug.

Initial SessionFactory creation failed.org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
...
...
Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.connection.C3P0ConnectionProvider] as strategy [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]

My POM.XML

<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>5.1.16.Final</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc4</artifactId>
    <version>4.0</version>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

How should I start the Press correctly?

  • Try adding this dependency https://mvnrepository.com/artifact/org.hibernate/hibernate-ehcache/5.3.7.Final

  • Unsuccessful ... on account of the tried version with .... https://search.maven.org/artifact/org.hibernate/hibernate-ehcache/5.1.16.Final/jar

  • The other and maintaining the previous https://mvnrepository.com/artifact/com.mchange/mchange-commons-java/0.2.15

  • Also nothing.. same mistake

  • I forgot to mention that if I do not force the property he even finds the c3p0 but gives this error . 2018-10-23 18:01:40 WARN Connectionproviderinitiator:219 - HHH000022: c3p0 properties Were encountered, but the c3p0 Provider class was not found on the classpath; These properties are going to be Ignored.

  • I tried again without the property of the Provider and with the dependencies that quoted .. and even so persists the error .

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.