Hi;
With the point system posting an answer rather than a question is strongly discouraged - but I figure this is important enough to use up a point.
Tomcat 5.5 has changed how it does the JNDI settings for a JDBC setup. I am still working through some minor details making sure I have them exactly right. But the following works.
First, do not place anything in server.xml. Everything you do will go in your webapp directory. My webapp is named store.
Note: I do not create a war when developing so this is in an exploded directory.
META-INF/context.xml(complete):
<Context path="/store" docBase="store"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/storeDB" auth="Container" type="javax.sql.DataSource"
username="sa" password="mmouse" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=StoreTest;SelectMethod=cursor"
maxActive="8" maxIdle="4"/>
</Context>
web.xml (just the resource part):
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
...
<resource-ref>
<description>Connection to my DB.</description>
<res-ref-name>jdbc/storeDB</res-ref-name>
<res-type>javax.sql.DataSource </res-type>
<res-auth>Container</res-auth>
</resource-ref>
...
</web-app>
hibernate.cfg.xml (just DB part):
<session-factory>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.datasource">java:/comp/env/jdbc/storeDB</property>
...
</session-factory>
</hibernate-configuration>
AND - this is important - this will not work when run from IntelliJ! It only works if you start Tomcat and use it normally. Will post when I figure out the IntelliJ part.
thanks - dave