facebook

Setting Hibernate3 to use TOmcat 5.5.9 JNDI Datasource

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #239305 Reply

    Hi to all,
    i’m using MyEclipse 4.0.1, MySQL 4.1.1, Tomcat 5.5.9 and i’m trying (unluckly) to setting up Hibernate3 to use a JNDI defined in Tomcat 5.5.9.
    My WEB.xml is:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml, /WEB-INF/beans.xml</param-value>
      </context-param>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
          <welcome-file>start.jsp</welcome-file>
      </welcome-file-list>
       <resource-ref>
        <description>Pooling Connection</description>
        <res-ref-name>jdbc/MySQLDB_mambrini</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>
    

    My context.xml:

    
    <Context>
       <Resource name="jdbc/MySQLDB_mambrini" auth="Container"
                 type="javax.sql.DataSource"
            maxActive="100"
              maxIdle="30"
              maxWait="10000"
             username="mambrini"
             password="ars100"
      driverClassName="com.mysql.jdbc.Driver"
                  url="jdbc:mysql://localhost:3306/mambrini?autoReconnect=true" />
    </Context> 
    

    Now i want to know how do i have to write in hibernate.cfg.xml, to tell to hibernate to use the JNDI Connection Pool.
    Tnx in advance and sorry for my VERY bad english!!

    #239331 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this information is all coverd extensively in the Hibernate documentation at http://www.hibernate.org, and can do a much better job explaining it than I can 😉

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Setting Hibernate3 to use TOmcat 5.5.9 JNDI Datasource

You must be logged in to post in the forum log in