JNDI Datasource v/s Regular Datasource
Dear All,
We have an application which are deploying on Oracle Application Server's OC4J Container. The confusion I seem to be in is whether to use a JNDI Datasource(ofcourse as a spring manged bean) or a Regular Datasource to access the database. It would be more clear with a piece of code.
Should I use
Code:
<bean id="jndiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/HomeTestDB</value>
</property>
</bean>
or
Code:
<bean id="dataSource" class="<SomePolledDataSource>" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:home"/>
<property name="username" value="scott"/>
<property name="password" value="tiger"/>
<property name="autoCommit" value="true"/>
<property name="suppressClose" value="true"/>
</bean>
I would really like to know what would be the advantages/disadvantage of one over the other and what is the best practice in implementing this.
Thanks in advance,
Franklin