[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - use jboss conn pooling with hibernate

mikedanese do-not-reply at jboss.com
Fri Dec 1 14:52:38 EST 2006


JBoss4.04  Hibernate3
Followed documentation to setup jboss conn pooling but this msg appears in server.log :

11:18:37,500 INFO  [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
11:18:37,765 INFO  [DriverManagerConnectionProvider] Hibernate connection pool size: 20
11:18:37,765 INFO  [DriverManagerConnectionProvider] autocommit mode: false
11:18:37,765 INFO  [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/alertnet2

Is the log msg in error?
How do I get hibernate pointed to jboss conn pooling??


mysql-ds.xml


  <local-tx-datasource>
    <jndi-name>jdbc/mySQL</jndi-name>
    <connection-url>jdbc:mysql://localhost/alertnet2</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>capuser</user-name>
    capuser
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
    <!-- intent: close pooled connections sitting idle for 30 minutes   -->
    <idle-timeout-minutes>30</idle-timeout-minutes>
    <!-- should only be used on drivers after 3.22.1 with "ping" support -->
    <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
    <!-- sql to call when connection is created       -->
    <new-connection-sql>Select 1 from USER</new-connection-sql>
    <!-- sql to call on an existing pooled connection when it is obtained from pool 
      - MySQLValidConnectionChecker is preferred for newer drivers        -->
    <check-valid-connection-sql>Select 1 from USER</check-valid-connection-sql>
    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
    
       <type-mapping>mySQL</type-mapping>
    
  </local-tx-datasource>


<jboss-web>
  <context-root>/</context-root>
  <resource-ref>
    <res-ref-name>jdbc/mySQL</res-ref-name>
    <jndi-name>java:/jdbc/mySQL</jndi-name>
    <res-type>javax.sql.DataSource</res-type>
  </resource-ref>
  </jboss-web>


in web.xml:

    <resource-ref>
        The default MySql DS
        <res-ref-name>jdbc/mySQL</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

and in hibernate.cfg.xml:
<hibernate-configuration>
    <session-factory>
        com.mysql.jdbc.Driver 
        jdbc:mysql://localhost/alertnet2 
        <property name="hibernate.connection.username

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990547#3990547

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990547



More information about the jboss-user mailing list