Passing a data source as a JNDI name
To use an JNDI name, the prefix jndi: needs to be provided. The example below assumes the use of Aries JNDI to expose services via JNDI.
<jaas:config name="karaf">
<jaas:module
className="org.apache.karaf.jaas.modules.jdbc.JDBCLoginModule"
flags="required">
datasource = jndi:aries:services/javax.sql.DataSource/ \\
(osgi.jndi.service.name=jdbc/karafdb)
query.password = SELECT PASSWORD FROM USERS WHERE USERNAME=?
query.role = SELECT ROLE FROM ROLES WHERE USERNAME=?
</jaas:module>
</jaas:config>