• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem of synchronization between two Oracle databases

 
Samy Ganou
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 databases DB1 and DB2,
On DB2 : table2 and a table3
on DB1 : table1 and a synonym of the table3 : SynTable3.

I have a java batch that make a loop to get records from DB1.table1 and insert it on DB2.table2 ,
The loop make a select of x record from table1, where records have not entries on Syntable3 , insert them on Table2 and insert entries on table3 .
then pass to the next x records ...
The problem is that somtimes the loop get x record treat them , and on the next loop it get the same records , but they already exist on the table3 , I don't know if the synTable3 is rapidely refreshed by the modification of the last loop.
there is a solution to be sure that Syntable3 is rapidely up to date when we insert data on table3 ?
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changes to tables in Oracle are effective immediately for the current session, and are seen by other sessions after you commit.
Do you commit after inserting?

 
Samy Ganou
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:Changes to tables in Oracle are effective immediately for the current session, and are seen by other sessions after you commit.
Do you commit after inserting?



Yes i do the commit.
The problem does not appear when i make double query execution to select my data.
tResultSet = tPreparedStatement.executeQuery();
tResultSet = tPreparedStatement.executeQuery();
the first execution give me somtimes old data of the last loop query , but the second query give me the new data.

I dont know why does this occurs , though i free all statements , results and connection after every loop step .
Can you help me to find a more clean solution?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic