|
Thanks for your reply, that helped. I had a little trouble figuring out how the reference was actually bound to the datasource. I used the web-xml editor in WDSc and added the jndi binding under the 'WebSphere Binding' tab, but couldn't see it when I looked at the source of web-xml. When I ran the app the first time, I got a "A reference to an ResourceRef" exception. A search on google found a developerWorks post mentioning multiple bindings in ibm-web-bnd.xmi. I checked in my .xmi file and there were multiple entries there. Removing them fixed the problem and all my warning message are gone. >>> francess@xxxxxxxxxx 3/15/2006 6:20:19 PM >>> Hi, This page in the documentation explains the error message and deprecation: http://publib.boulder.ibm.com/infocenter/wsdoc400/topic/com.ibm.websphere.iseries.doc/info/ae/ae/rdat_jnditips.html?resultof=%22%64%69%72%65%63%74%22%20%22%6c%6f%6f%6b%75%70%22%20 This page has a short description looking up a datasources relational DB access and short example: http://publib.boulder.ibm.com/infocenter/wsdoc400/topic/com.ibm.websphere.iseries.doc/info/ae/ae/cdat_datsorres.html?resultof=%22%64%61%74%61%73%6f%75%72%63%65%22%20%22%64%61%74%61%73%6f%75%72%63%22%20%22%6c%6f%6f%6b%75%70%22%20 The page has some appropriate related resource links at the bottom too I think. Here is an example from the documentation of using the indirect lookup (excerpted from http://publib.boulder.ibm.com/infocenter/wsdoc400/topic/com.ibm.websphere.iseries.doc/info/ae/ae/rdat_dawp04.html?resultof=%22%64%61%74%61%73%6f%75%72%63%65%22%20%22%64%61%74%61%73%6f%75%72%63%22%20%22%6c%6f%6f%6b%75%70%22%20): //************************************************************************************ //* The getDS method performs the JNDI lookup for the DataSource. //************************************************************************************ private void getDS() { try { Hashtable parms = new Hashtable(); parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); InitialContext ctx = new InitialContext(parms); // Perform a naming service lookup to get the DataSource object. ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SampleDB"); } catch (Exception e) { System.out.println("Naming service exception: " + e.getMessage()); e.printStackTrace(); } } "Nancy Cochran" <ncochran@xxxxxxx > To Sent by: <java400-l@xxxxxxxxxxxx> java400-l-bounces cc @midrange.com Subject indirect jndi lookup of resource 03/15/2006 03:12 PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@midran ge.com> 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"); -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.