• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys !
Working with Tomcat4.1
Explicitly specifying the username / password in the server.xml file works fine. However, using
Connection con = ds.getConnection("userid","pass");
throws the following exception -
java.lang.UnsupportedOperationException
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:125)

What needs to be done ???
Pls Suggest
Thanks
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before trying code that passes in the username/password to the getConnection() method, did you try removing the username/password from server.xml and restarting ?

that's just a guess.
 
Sam Furtado
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Mike
Thanks for your reply !
Yes, I've done that Mike.
I've even edited the web.xml with this piece of code :-
<res-auth>Application</res-auth>
and the following edit in server.xml:-
<Resource name="jdbc/TempDB" auth="Application" type="javax.sql.DataSource"/>
(as per the jsp specification)
which means that now authentication would now be carried out by the "Application" instead of the "Container".

Does it have to do anything with the version of Tomcat in use - Tomcat4.1 ???
This is a serious problem. What should be done ???
Pls suggest.
Thanks
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used anything other than container in resource-auth. Have you tried switching it back to that, just to see what would happen?

Also, it's probably not Tomcat. It is most likely the db connection pool you are using that doesn't support the use of getConnection() with username and password. (I'd guess that from the stack trace).
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic