• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Parse text file and query dabase and email missingList as CSV file

 
Ranch Hand
Posts: 842
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a pipe(|) separated text file with many rows of data. I need to parse the text file and generate a query and query database and see which records are not there in database( each row of the text field corresponds to each record in database). Then I need to prepare missing List CSV file and email the user about the missing list values. I am treating whole text file as array object and individual rows as again small arrays with many values(could be string, numericals etc) separated by | symbol.
Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
 
lowercase baba
Posts: 13081
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My general suggestions are always the same:

Separate your tasks into the individual components. Reading a file is a distinct task from querying the database. Parsing a string is a distinct task from building a query.

Only work on one task at a time. Test it over and over and over and make sure it works before doing the next task.
 
sai rama krishna
Ranch Hand
Posts: 842
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you.

http://www.velocityreviews.com/forums/t390377-using-scanner-with-a-bar-delimiter.html

I checked above link.

It is separating at |.

Now I need to get first two strings and form a query with those first 2 stings to run againest the oracle database.

Then generate missing list CSV report(with those first two strings) if those records not present in oracle databse and email the the user missing CSV file(i have the emailing part code also with me).

I am not sure on how to do following things


>>
Now I need to get first two strings and form a query with those first 2 stings to run againest the oracle database.

>>
Then generate missing list CSV report(with those first two strings) if those records not present in oracle databse

Please advise
 
fred rosenberger
lowercase baba
Posts: 13081
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This:

Now I need to get first two strings and form a query with those first 2 stings to run againest the oracle database.


is at LEAST three things:
1) Get the first two strings
2) Form a query from two strings
3) Run a query against a database.

Focus on one at a time.
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic