Oracle rownum in db2 - Java data archiving

Posted by HonorGod on Stack Overflow See other posts from Stack Overflow or by HonorGod
Published on 2010-04-13T16:03:10Z Indexed on 2010/04/29 4:57 UTC
Read the original article Hit count: 493

Filed under:
|
|

I have a data archiving process in java that moves data between db2 and sybase. FYI - This is not done through any import/export process because there are several conditions on each table that are available on run-time and so this process is developed in java.

Right now I have single DatabaseReader and DatabaseWriter defined for each source and destination combination so that data is moved in multiple threads. I guess I wanted to expand this further where I can have Multiple DatabaseReaders and Multiple DatabaseWriters defined for each source and destination combination.

So, for example if the source data is about 100 rows and I defined 10 readers and 10 writer, each reader will read 10 rows and give them to the writer. I hope process will give me extreme performance depending on the resources available on the server [CPU, Memory etc].

But I guess the problem is these source tables do not have primary keys and it is extremely difficult to grab rows in multiple sets.

Oracle provides rownum concept and i guess the life is much simpler there....but how about db2? How can I achieve this behavior with db2? Is there a way to say fetch first 10 records and then fetch next 10 records and so on?

Any suggestions / ideas ?

Db2 Version - DB2 v8.1.0.144 Fix Pack Num - 16 Linux

© Stack Overflow or respective owner

Related posts about db2

Related posts about java