Dear all
I defin a datasource in the JBoss 4.2.3
The configure as below
jboss-web.xml
<jboss-web>
<resource-ref>
<res-ref-name>MyDB</res-ref-name>
<jndi-name>java:/db</jndi-name>
</resource-ref>
</jboss-web>
web.xml
<resource-ref>
<res-ref-name>MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
oracle-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>db</jndi-name>
<connection-url>jdbc:oracle:thin:@localhost:1521:TESTDB</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>user</user-name>
<password>user123</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
In my hibernate.cfg.xml
<property name="hibernate.connection.datasource">MyDB</property>
But I can't find the jndi datasource.
If I use the following configure, it works fine.
<property name="hibernate.connection.datasource">java:comp/env/MyDB</property>
Are there any solution that I just only use MyDB instead of java:comp/env/MyDB?
Instead of java:comp/env/MyDB you can use java:db