facebook

Hibernate, Tomcat and JNDI Setup

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #252102 Reply

    Durnik
    Member

    I’m starting a new web project and running into issues with exactly how to configure Hibernate, Tomcat and Derby to support a database backend web app. While I’ve searched the web high and low, I can’t find a how-to, tutorial or instructions that cover what I’m trying to do. My high-level requirements are:

    1) Single database that multiple web apps will utilize (think reporting app versus input app)
    2) Web app will be written using the JSF framework
    3) Use Tomcat’s JNDI database buffer pooling
    4) Use Hibernate as the database-to-POJO framework

    Using any and all documentation I could find, I *think* I have Tomcat configured properly in that:

    1) Copied the Derby jar file to <tomcat>\common\lib
    2) Created a JNDI resource in the server.xml file GlobalNamingResources that looks like so:

    <!– Global Datasource for the TCTClient database –>
    <Resource name=”jdbc/tctclient”
    type=”javax.sql.DataSource” auth=”Container”
    description=”Derby database for the TCTClient App”
    maxActive=”100″ maxIdle=”30″ maxWait=”10000″
    username=”” password=””
    driverClassName=”org.apache.derby.jdbc.EmbeddedDriver”
    url=”jdbc:derby:databases/tctclient”/>

    However, here’s where things go south on me. When adding Hibernate capabilities to the web app project I get stuck. The third panel into the process (the wizard), ask me to specify the “Database connection details”, it asks for DataSource, ConnectURL, Factory, Username, Password and Dialect and I’m unsure what’s supposed to go into these fields and what are the steps I need to take.

    For the fields I’m using:

    DataSource = jdbc/tctclient
    URL = jdbc:derby:databases/tctclient
    Factory = blank
    Dialect = Derby (the easy one)

    The fourth panel asks me for the session factory class and using the “packages” button I select src/defaultpackage

    So, the questions I have are:

    1) Does the database actually have to be created prior to enabling hibernate capabilities?
    2) Where is the database ‘databases/tctclient’ actually going to be created path wise (or where should I create it)?
    3) Are the values I entered into the wizard correct for my connection type?

    Any and all help would be appreciated

    ===============================================
    *** Date: Tue May 16 11:52:50 EDT 2006

    *** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_06

    *** MyEclipse details:
    MyEclipse Enterprise Workbench

    Version: 4.1.1 GA
    Build id: 20060228-4.1.1-GA

    *** Eclipse details:
    Eclipse SDK

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Platform

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse RCP

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Java Development Tools

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Plug-in Development Environment

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Project SDK

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    E:\Development\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    f24_68
    -vm
    C:\WINDOWS\system32\javaw.exe

    #252137 Reply

    Riyad Kalla
    Member

    1) Does the database actually have to be created prior to enabling hibernate capabilities?

    No, it’s just asking you the connection information so it can put it in the generated hibernate.cfg.xml file for you

    2) Where is the database ‘databases/tctclient’ actually going to be created path wise (or where should I create it)?

    Check some tutorials on JNDI, there is a default prefix to the lookup you may or may not need. Otherwise just entering in the JNDI path you gave it might work. I always forget (the full path looks somethin like java:env/comp/blah)

    3) Are the values I entered into the wizard correct for my connection type?

    If they aren’t you can change them using a nice editor later, so you aren’t locked in to a one-time choice.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Hibernate, Tomcat and JNDI Setup

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