How to use jndi datasource provided by tomcat in spring?
Answer / Ankur Kesarwani
To use a JNDI data source provided by Tomcat in Spring, you should first create and configure the data source within your Tomcat `server.xml` or `context.xml` file. Then, in your Spring application context file (usually an XML or Java-based configuration class), define the data source as a bean using JNDI lookup:
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/MyDataSource"/>
</bean>
| Is This Answer Correct ? | 0 Yes | 0 No |
On which port does apache work?
How do I know what port tomcat is using?
I have a "webb app" in Tomcat that serves only HTML, and I'd like to make the path component of the URL case- insensitive. So if the client navigates to http://<domain.host>/Pics or http://<domain.host>/pics or http://<domain.host>/PIcs they'll get the same resource.
How can we specify system properties in tomcat configuration on startup?
What is a mod_evasive module?
what are the connectors used in tomcat?
Where is apache net server situated in information heart location?
How do you deploy ejb in tomee?
What is the difference between worker and prefork mpm?
Is tomcat a jvm?
What is tomcat and how it works?
How do I use datasources with tomcat?