• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create stand alone java application

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have always coded web applications using jsp's and depending what is selected from the web page then methods in java classes are called and processed, but always returning to the jsp.
Now, I want to write a java program that simply reads a table, selecting off certain records, using data from these records to populate fields in output records and write the formatted output records to a flat file.
After all records are processed I need to hand off the flat file using NDM which will transmit the file to a server where another application will process these records.

A cron job will automatically run daily which will kick off my process. Will this cron job execute my stand alone java program containing a main method?

My processing consists of reading one record from table, performing a few calculations using data from record, populating the output record and writing this record to a flat file.

Should I include the connection and table processing in this same class or call a method in a separate class that performs the table stuff?
 
Don Martino
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me simplify my question;

I want to read records from a table, format and write new records to output flat file.

Do I simply write one java class that does it all or do I write another java class that performs the database processing?
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably better to have a class which handles the transmission to the database and back, and other classes which handle input and output.
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I would do it, I would separate the classes to talk to the db, to process the data and to talk to the files.

Regards
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its better to divide your operation into steps communicating to database,format it as your required format and send back to the server. Now in simple way you can create a class for each steps and make them to communicate with each other by passing the required data.

If you want to automate your process you can go for scheduler and timertask in java .
reply
    Bookmark Topic Watch Topic
  • New Topic