Skip to main content

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>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!