• 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 datasource

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I am using Websphere 6.0 and I am able to create a jndi datasource through admin console and gave it a name jdbc/asm_met. Now can anyone please tell me the code how to access this datasource in a jsp page. I want to use JSTL for running the queries.
Please provide me the detail code for accessing it through my jsp.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aman,
Don't you just pass the Datasource name into the JSTL tag as shown?

Note that it is bad practice to do database from the JSP layer. JSPs are for presentation. You would be better served calling the database from a servlet (or class called by the servlet) before forwarding to the JSP.
 
Aman Singh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
Thanks for your reply. The example you gave me is for tomcat server, where we specify the JNDI sources in server.xml file. I am using Websphere and made the JNDI resource using the admin console. Now Do I just need to call it using the datasource name ?

Another question. Please tell me how to work this stuff with thr use of servlet. Should I make a jdbc connection using a servlet? if so then how do I pass that connection to my JSP? please help me out with this.. I am new to all this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic