This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem of synchronization between two Oracle databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem of synchronization between two Oracle databases " Watch "Problem of synchronization between two Oracle databases " New topic
Author

Problem of synchronization between two Oracle databases

Samy Ganou
Greenhorn

Joined: Oct 05, 2009
Posts: 28
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

Joined: Dec 20, 2006
Posts: 2516
    
  10

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?


OCUP UML fundamental and ITIL foundation
youtube channel
Samy Ganou
Greenhorn

Joined: Oct 05, 2009
Posts: 28
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem of synchronization between two Oracle databases