• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

DataSource via JNDI in WSAD 5

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there !
I�m trying to configure my web application to get a connection via JNDI lookup , but I think I might be missing some step.
First , I configured a DataSource in the Server�s Configuration DataSource tab... which I called jdbc/SAUDEMED . Then I configured the web.xml , in the References tab I added the jdbc/SAUDEMED resource.
The class that makes the JNDI lookup has the following code :
DataSource ds = null;
try {

// ds = (DataSource) initCtx.lookup("jdbc/SAUDEMED");
ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/SAUDEMED");
In fact, I still haven�t been told why I must use this "java:comp/env/" before my JNDI name... Any idea ?
Then , when I run the app, I get the following error :
" No container-managed authentication alias was found " ...
The Conection Pool Manager could not allocate a managed connection javax.resource.spi.ResourceAllocationException: Caught ResourceException thrown during creation of the ManagedConnection.
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1138)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
And so on...
In addition to it, where do I have to declare my username and password for the database connection ? In the JNDI / DataSource configuration there wasn �t such step...
Any help would be greatly appreciated...

Thanx in advance !
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is answered in another thread (which I don't have time to look for) but I'll drop a short version here and you can look for the other thread that has more details.
In the WAS 5 test srever for WSAD 5, you declare a dource, declare a user, then assign the user to the datasource.
In the server config, click the security tab. In the bottom half is where you define the authentication user. Go back to your data source and you should now be able to select this user to authenticate your datasource.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic