|
How do I use an indirect jndi lookup of a datasource? WAS 6 server
gives a warning that direct JNDI lookups are depreciated and I should be
using indirect lookups. I tried the following code and still get the
warning. Is there something I need to set up in the WAS server, like a
Connection Factory? The code works, just gets the warning message in
the server logs. The word 'indirect' tells me that I shouldn't be using
the datasource name in the application code, but I can't figure out the
correct code.
web-xml:
<resource-ref>
<res-ref-name>jdbc/myds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
application code:
InitialContext ctx = new InitialContext();
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myds");
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.