I have a jndi resource setup and working correctly. I was using JDBCRealm but now that I have my datasource setup I'd like to use DatasourceRealm.
I get "javax.naming.NameNotFoundException: Name jdbc is not bound in this Context" error when trying to login
context.xml:
<Context>
<Realm debug="99"
className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/MyDb"
userTable="usrsec"
userNameCol="usrsec_userid"
userCredCol="usrsec_pswd"
userRoleTable="usrsec" roleNameCol="usrsec_level"
/>
<Valve className="flex.messaging.security.TomcatValve"/>
</Context>
jboss-web.xml:
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/MyDb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:jdbc/MyDb</jndi-name>
<res-auth>Container</res-auth>
</resource-ref>
</jboss-web>
Part of my web.xml:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/MyDb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
database-ds.xml:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/MyDb</jndi-name>
<!-- Sybase jConnect URL for the database.
NOTE: The hostname and port are made up values. The optional
database name is provided, as well as some additinal Driver
parameters.
-->
<connection-url>jdbc:ianywhere:DRIVER=SQL Anywhere 10;UID=xxx;PWD=xxx;ENG=HostServer;LINKS=tcpip(HOST=10.6.1.99;DoBroadcast=None)</connection-url>
<driver-class>ianywhere.ml.jdbcodbc.jdbc3.IDriver</driver-class>
<user-name>xxx</user-name>
<password>xxx</password>
<!--pooling parameters-->
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<!--<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>-->
<!-- sql to call when connection is created -->
<!-- sql to call on an existing pooled connection when it is obtained from pool -->
<check-valid-connection-sql>SELECT dbInfo_id FROM dbInfo</check-valid-connection-sql>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Sybase</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>