Hi Alexey,

you are allocating a new Kvart instance for each Resultset row.
You could change the code to save tons of ram as shown below.
You could also try to commit blocks of say 10000 Kvarts. This will save a lot of JDBC resources.


cheers,
Thomas

[EMAIL PROTECTED] wrote:
Hello everybody!
I made a investigate project (to see features of OJB). The current task of this project is move data from MSAccess database into MySQL.
For getting data from MSAccess I'm using JDBC directly (because I wasn't able to setup character set for MSAccess through OJB) and I'm using OJB for writing data into MySQL.


So, I got an "Out Of memory" error during copying a quite a big amount of data (about 1.500.000 records), so only about 400.000 records was copied.
The generated table is quite easy: one integer fields and 2 strings fields.


Here is a code how I'm doing copying:

                //select data from source database
                Statement stmt = getSourceConnection().createStatement();
                ResultSet rs = stmt.executeQuery("SELECT * FROM KVART");

//1. open transaction in destination database
getDestBroker().beginTransaction();

app.MySQL.Kvart transferKvart = > new app.MySQL.Kvart();

                while (rs.next()) {

                         transferKvart.setTel(rs.getInt("tel"));
                         transferKvart.setFio("fio");
                         transferKvart.setVidTel("vid_tel");
// save new phone
getDestBroker().store(transferKvart);

} //commit transaction getDestBroker().commitTransaction();

So, why in such simple case it generates out of memory error and how it is possible to fix it (may be I'm doing something wrong?)

I'm using db-ojb 1.0.rc6 with MySQL Connector/J version 3.0.11

Best Regards,
Alexey Kakunin
Project Manager
PIKOS GmbH
Post Str. 24
53111 Bonn

Tel: +49 30 43 72 92-30
Fax: +49 30 43 72 92-30

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to