File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Read Text FIle and put particular data in data base Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Read Text FIle and put particular data in data base" Watch "Read Text FIle and put particular data in data base" New topic
Author

Read Text FIle and put particular data in data base

karan chandok
Greenhorn

Joined: Jul 15, 2011
Posts: 25
"2011-6-14 16:3:56:468 # update_songList_central_Apply :: transIDISPATCH_P110256 # SUPDATE #reference_ID :: 1461758199 # Statement:com.mysql.jdbc.JDBC4CallableStatement@10b95f2: CALL proc_onsite_utility_transaction_response('1461758199','DISPATCH_P110256','25','SUPDATE','Idea','Assam','IMS','Sufiyana','','bf-song48980',@com_mysql_jdbc_outparam_out_mesg)out_para:1"



I am having text file with above mentioned data in every line

I want to insert only red coloured text into data base colums

Can anyone suggest how to do?

Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

You may do the following,
1. Split the line based on comma
2. Remove the surrounding single quotes
3. Take the necessary (red coloured text) data
4. Construct a INSERT statement, use JDBC and do the needful


S.D. MADHAN
Not many get the right opportunity !
karan chandok
Greenhorn

Joined: Jul 15, 2011
Posts: 25
Thanks Madhan

But that is my query

"How to select that particular(red text)" ony?

Can you please write code for that?It's very urgent
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

If you check out our AccessingFileFormats FAQ, section "Excel", you will find several CSV libraries. You can use one of these to assist you in steps 1-3 in Madhan's procedure. A single PreparedStatement will help you with step 4.

I personally have good experience with opencsv.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

karan chandok wrote:Can you please write code for that?It's very urgent

We are NotACodeMill. And please EaseUp; there's no such thing as "urgent" around here.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Read Text FIle and put particular data in data base