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.
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.
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.