Spring配置JNDI及通过JNDI获取DataSource
1、SpringJNDI数据源配置信息:
<bean id="dataSource" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" username="tysp"
password="12345678" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.1.105:1521:OA"/>
3、通过JNDI获取DataSource:
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("java:comp/env/jcptDataSourceJNDI");