我的目标是能够使用带有 Oracle VPD 的 Tomcat JDBC 创建“隔离会话”。如何在 Eclipse Link 中实现类似于SessionEventAdapter但具有更多 Tomcat 连接池的概念。我当前的客户端代码如下:
InitialContext initCtx = new InitialContext();
Context jndi = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) jndi.lookup("jdbc/" + _jdbcResource);
_connection = ds.getConnection();
_statement = _connection.prepareStatement(sqlStatement);
Context.xml中的资源定义
<Resource defaultAutoCommit="true" defaultReadOnly="false"
driverClassName="oracle.jdbc.OracleDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
fairQueue="false" initialSize="10"
jdbcInterceptors="ConnectionState;" jmxEnabled="true"
logAbandoned="true" maxActive="100" maxIdle="100"
maxWait="30000" minEvictableIdleTimeMillis="5000"
minIdle="10" name="jdbc/OracleApps" password="APPS"
removeAbandoned="true" removeAbandonedTimeout="600"
testOnBorrow="true" testOnReturn="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="5000"
type="javax.sql.DataSource" url="jdbc:oracle:thin:testmenot:1521:DEV"
useEquals="false" username="APPS" validationInterval="30000" validationQuery="SELECT 2+2 FROM DUAL"/>
如果需要任何信息,请告诉我。
谢谢。