• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read Text FIle and put particular data in data base

 
karan chandok
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 312
Java MS IE
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
karan chandok
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic