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?
posted 9 years ago
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?
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 .
All search starts with beginner's luck and all search ends with victor's severly tested.