我需要将xml中的数据源配置转换为java。我正在使用Java的DataSource impl。尝试使用OracleDataSource对象,但有一些功能我无法定义,例如:语句缓存大小
你有什么建议,我应该使用哪种DataSource impl?为了变换对象,正确的用法是什么?
XML:
<data-source action="update" name="serverNm">
<database-name />
<minimum-pool-size>0</minimum-pool-size>
<maximum-pool-size>6</maximum-pool-size>
<connection-timeout>1</connection-timeout>
<idle-timeout>600</idle-timeout>
<orphan-timeout>30</orphan-timeout>
<statement-cache-size>100000</statement-cache-size>
<other-props>stmtBuffCleanPolicy=;</other-props>
<default-user />
<default-password />
<disable-auto-connectioncleanup>false</disable-auto-connectioncleanup>
<description />
<jndi-name>jdbc/serverNm</jndi-name>
<logging-options>-1</logging-options>
<config-properties>
<property name="URL"
value="jdbc:oracle:thin:@hostName:1521:S81U" />
<property name="user" value="user" />
<property name="password" value="password" />
<property name="driverType" value="" />
<property name="driverConfig" value="" />
<property name="connRateThrottle" value="60000" />
<property name="connectionProperties"
value="oracle.jdbc.V8Compatible=true;oracle.jdbc.TcpNoDelay=true;oracle.jdbc.RetainV9LongBindBehavior=true" />
</config-properties>
</data-source>Java:
OracleDataSource ds = new OracleDataSource();
ds.setDriverType(dbDriverClassName);
ds.setURL(host);
ds.setUser(user);
ds.setPassword(password);谢谢
发布于 2017-03-06 23:20:20
如果满足您的需要,请查看接口PoolDataSource和它的一些可能的implementation。
https://stackoverflow.com/questions/42628539
复制相似问题