top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to use application server JNDI DataSource with Hibernate framework?

+1 vote
399 views
How to use application server JNDI DataSource with Hibernate framework?
posted May 10, 2016 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

For web applications, it’s always best to allow servlet container to manage the connection pool. That’s why we define JNDI resource for DataSource and we can use it in the web application. It’s very easy to use in Hibernate, all we need is to remove all the database specific properties and use below property to provide the JNDI DataSource name.

<property name="hibernate.connection.datasource">java:comp/env/jdbc/MyLocalDB</property>
answer May 20, 2016 by Karthick.c
...