我的目標是能夠使用Tomcat JDBC和Oracle VPD創建'隔離會話'。我如何在Eclipse Link中實現類似於SessionEventAdapter的概念,但使用更多的Tomcat連接池。下面我現在的客戶端代碼:context.xml中Tomcat的Oracle VPD會話問題JDBC
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);
資源定義
<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"/>
請不要讓我知道,如果需要的任何信息。
謝謝。