Hello,
I'm building my first application with hibernate. I like it very much.
My problem is to switch from default connection pooling to DBCP. The following configuration works fine:
Code:
<hibernate-configuration>
<session-factory>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://tiger/DokuStelleDB</property>
<property name="hibernate.connection.username">DokuStelleDBUser</property>
<property name="hibernate.connection.password">DokuStelleDBUser</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="org/dokustelle/model/place/StandortImpl.hbm.xml"/>
</session-factory>
</hibernate-configuration>
And the next configuration doesn't work:
Code:
<hibernate-configuration>
<session-factory>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://tiger/DokuStelleDB</property>
<property name="hibernate.connection.username">DokuStelleDBUser</property>
<property name="hibernate.connection.password">DokuStelleDBUser</property>
<property name="hibernate.connection.provider_class">net.sf.hibernate.connection.DBCPConnectionProvider</property>
<property name="hibernate.dbcp.validationQuery">Select 1</property>
<property name="hibernate.dbcp.maxActive">50</property>
<property name="hibernate.dbcp.maxIdle">10</property>
<property name="hibernate.dbcp.maxWait">3000</property>
<property name="hibernate.dbcp.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.ps.maxActive">50</property>
<property name="hibernate.dbcp.ps.maxIdle">10</property>
<property name="hibernate.dbcp.ps.maxWait">3000</property>
<property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="org/dokustelle/model/place/StandortImpl.hbm.xml"/>
</session-factory>
</hibernate-configuration>
The log-output is:
Code:
...
31.01.2004 14:31:54 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
31.01.2004 14:31:55 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNUNG: SQL Error: 0, SQLState: 08001
31.01.2004 14:31:55 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SCHWERWIEGEND: No suitable driver
31.01.2004 14:31:55 net.sf.hibernate.JDBCException <init>
SCHWERWIEGEND: Cannot open connection
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:97)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:300)...
I'm using
- Hibernate 2.1
- Tomcat 5.0.16
- Struts 1.1
- SUN J2SDK 1.4.2-b28
- MySQL 4.0.15
- SUSE Linux 9.0
and I have the following jar's im my WEB-INF/lib:
- cglib2.jar
- commons-beanutils.jar
- commons-collections.jar
- commons-dbcp.jar
- commons-digester.jar
- commons-fileupload.jar
- commons-lang.jar
- commons-logging.jar
- commons-pool.jar
- commons-validator.jar
- dom4j.jar
- ehcache.jar
- hibernate2.jar
- jakarta-oro.jar
- jdbc2_0-stdext.jar
- jgroups.jar
- jta.jar
- mysql-connector-java-3.0.10-stable-bin.jar
- odmg.jar
- struts.jar
- xalan.jar
Any help or hints are welcome!
Olli N.