Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

JDBC and Transparent Application Continuity

cptkirkshDec 15 2023

Well in my testing of Oracle TAC I seem to have run into a roadblock. Since I am a DBA and not a Java developer that may be the reason. Here is what I have. TAC works when running via SQLPLUS so I know the service is setup correctly. Yet when I run it using a Java app it fails with the following error.

Dec 14, 2023 12:57:43 PM oracle.jdbc.replay.driver.TxnFailoverManagerImpl throwOriginalExceptionWithReplayError 
WARNING: U:thread-1 main On CONN$$$Proxy@db57326, replay failed in method executeUpdate, error code: 384, reason: java.sql.SQLException: ORA-17384: Replay is disabled by server Continuity Management: executeUpdate

Now in my Java code I have it setup using UCP like this.

String CONN_FACTORY_CLASS_NAME = "oracle.jdbc.replay.OracleDataSourceImpl"; 
String ORACLE_WALLET = "c:\\oracle\\wallet"; 
String TNS_ADMIN = "C:\\oracle\\product\\19.3.0\\client_1\\network\\admin"; 
String WALLET_URL = "jdbc:oracle:thin:hr/myuser@pdb_tac"; 
System.setProperty("oracle.net.tns_admin", TNS_ADMIN); 
System.setProperty("oracle.net.wallet_location", "(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=" + ORACLE_WALLET + ")))"); 

PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); 
pds = PoolDataSourceFactory.getPoolDataSource(); 
pds.setConnectionFactoryClassName(CONN_FACTORY_CLASS_NAME); 
pds.setURL(WALLET_URL); 
pds.setConnectionPoolName("JDBC_UCP_POOL"); 
pds.setInitialPoolSize(5); 
pds.setMinPoolSize(5); 
pds.setMaxPoolSize(20); 
pds.setTimeoutCheckInterval(5); 

//enable FAN and connection tests 
pds.setFastConnectionFailoverEnabled(true); 
pds.setValidateConnectionOnBorrow(true); 

//disable auto-commit 
pds.setConnectionProperty(OracleConnection.CONNECTION_PROPERTY_AUTOCOMMIT, "false"); 
pds.setConnectionProperty(OracleConnection.CONNECTION_PROPERTY_IMPLICIT_STATEMENT_CACHE_SIZE, "100"); 

// Default is 0. Set the maximum time, in seconds, that a 
// connection remains available in the connection pool. 
//this line allows the pool push connections in and out of each node. 
pds.setInactiveConnectionTimeout(10); 

//Validate connection has nothing to do with reconnections 
pds.setValidateConnectionOnBorrow(true); 
pds.setSQLForValidateConnection("select 1 from dual"); 

Connection conn = pds.getConnection(); 
DbUpdate2 self = new DbUpdate2(); 
//conn = dataSource.getConnection(); 
conn.setAutoCommit(false); 
self.getInstanceName(conn); 

String var10000 = self.getInstanceName(conn); 
System.out.println("Instance Name = " + var10000); 
System.out.println("Kill node and wait after press any key:" + var10000 ); 

self.pressAnyKeyToContinue(); 
System.out.println("Wait while 5000 records updated"); 

//uncomment to test with spy table 
self.doTx(conn,numValue);

What am i missing Here? Thanks in advance

Comments
Post Details
Added on Dec 15 2023
0 comments
42 views