This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I want to know how to use multithreading in JDBC? I am in the middle of developing a multithreaded program to read data from ms-access and dump into db2 tables after some calculation. I am calling this tool as data migration tool.
Each ms-access mdb is a fund database (contains atleast 50,000 rows). user can enter any number of funds in the text field(front end GUI) and click submit, and my java program iterates fund number of times and creates a thread which actually copies data from MDBs to db2 table. multiple MDBs on ms-access and only one table on DB2.
some thing like: for(i=0; i<n; i++) //n=50 for 50 funds entered from GUI. { Runnable rr = new MyClass(fundid); Thread t1 = new Thread(rr); t1.start(); } run() { //open connection to ms-access //open connection to db2 //read data from ms-access and store in ArrayList //And copy data from ArrayList(after calculation) to db2 table. } if user enters 50 funds like ('TH32','2201','2202'......) in the text field, my program iterates 50 times creating 50 threads. And the program is running slow, not to the desired speed.
Is the logic used correct for multithreading in JDBC. Can I create as many threads as the number of funds?
More over the set up is some thing like this: My program runs on windows server where mdb files are present and dumps to a database (db2) table which resides on a LINUX machine in the network.
Thanks for the reply. I went thru the link you have sent for no multi-threading in JDBC-OCBC bridge.
You mean each thread executes sequentially? Like, a new thread connecting to an mdb and reading data will occur only when the previous thread finishes reading data from the mdb? Is that correct?
And how about data which is read and stored in the ArrayList and trying to copy this data into db2 using type4 jdbc driver. Does this executes concurrently?
Let me know what more info I can provide to be myself more clear.
Thanks,
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.