When you set up a JDBC datasource on an application server, at least in my experience, you must give a JNDI name to that datasource. However, in the deployment descriptor for the application we also have the resource-ref entry that references the JNDI name of the datasource. What is the idea behind the resource-ref entry in the deployment descriptor?
When you set up a JDBC datasource on an application server, at least in my experience, you must give a JNDI name to that datasource.
You can access a database with the JDBC API without using JNDI ,but yes when it comes to datasource you have to use some naming service,I too have used JNDI.
As for the question ,
There are many reasons that according to the specification, one should also specify the <resource-ref> in web.xml. One of the most important reasons is the scopeof the DataSource being used.
Thanks for the reply... and yes, I do realize that JNDI is not the only way to access your JDBC driver/connection.
So, what I am starting to think is that the resource-ref entry really applies more EJBs are used. I am just using POJOs for my JDBC so I think I will just add it to my web.xml and not think about it too much (unless it breaks ).