[jboss-user] [JNDI and Naming] - Can't find JNDI datasource
zxcvzxcv poiuyu
do-not-reply at jboss.com
Thu Mar 17 05:04:54 EDT 2011
zxcvzxcv poiuyu [http://community.jboss.org/people/qwertqwert] created the discussion
"Can't find JNDI datasource"
To view the discussion, visit: http://community.jboss.org/message/593673#593673
--------------------------------------------------------------
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?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/593673#593673]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110317/4ae3682c/attachment.html
More information about the jboss-user
mailing list