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 wan't to know that if i write all the data in another data into text file and then i want to read from the text file and save the database in another database. how i have to write this program to read data from the text file and save the data into another database
hope anyone here can give some opinion or giv some light to me thank you
Your post is confusing. What exactly are you charged with doing? If it is simply parsing a file and inserting data into a database, there are plenty of tools that can do what without any programming. What makes you think that you need to use Java?
If you are really asking "How can I read data from a text file and insert the rows in to a table in a database?" then the answer is :
use I/O methods to read the text file in to an ArrayList. Something like :
Make sure the text file is properly formatted and have some kind of a separator (say |) between columns and then use JDBC to insert the data in to the table.
[ March 30, 2006: Message edited by: vishwanath nadimpally ] [ March 30, 2006: Message edited by: vishwanath nadimpally ]
albert sie
Ranch Hand
Joined: Jan 15, 2006
Posts: 108
posted
0
thanks vishwanath nadimpally you posting really will help me.
what i want to say is, i want to transform the data from the informix database to the MySql database. for do this i need to retrieve the data from the informix database and write into the text file with the seperator(|) and line break (/n). what i need to do is to write the java program that can read the data from the text file and put back the data in the mysql database, that's my case.
So any opinion and comment or suggestion, please...please... enlighten me.
thank you... thank you...
regards, albert
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Do you *have to* do the intermediate step of storing the data in a file? Why not select the data from the first database and immediately insert it into the second database? This would avoid the fiddly bits of parsing.
albert sie
Ranch Hand
Joined: Jan 15, 2006
Posts: 108
posted
0
can do like this?? coz i transfer informix database data to the MySQL server data. if can provide me the solution on how to do it or any other reference. thank you.
regards, albert
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Originally posted by albert sie: can do like this?? coz i transfer informix database data to the MySQL server data. if can provide me the solution on how to do it or any other reference.
Isn't not clear what you are refering to. Can you write code that reads from the first database? Cand you write code that writes to the second database? Can you stick these two together?
albert sie
Ranch Hand
Joined: Jan 15, 2006
Posts: 108
posted
0
i mean is it can transfer directly the data from 1st database to the second database without passing in to the text file? coz my 1st database is informix and the 2nd database is MySQL, both is different database.
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
You don't have to write that intermediate step where you store the data in a text file.
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.
subject: read text file and save data into database