Hibernate 5.1.16.Final + MSSQL + Java7 + C3P0

0

I am successfully using hibernate to query an 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>

I get the crash.

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 properly initiate the provider?

    
asked by anonymous 23.10.2018 / 21:30

0 answers