[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

How to flag a row of a mysql table which is read through a Java Program? (mySQL+JAVA)

Hello Everybody,

I have a problem with flagging the rows of table(mysql) which were read and which aren't.I will explain my problem.

I am uploading a file by means of a JSP(text file which contains job requirements) to mySQL database table.And i have to read the file from databse by means of another  JAVA program and submit that file to PBS (Job management and execution software).I am able to read the file from database and could submit it to the database.

My problem is i have to read the table row (which contains the file) only once because i have to submit the file to PBS only once.How can i flag the file which one is read (i mean which row of table is read or not).

Suppose 3 different persons submitted files(different file with job requirements) to the database.Let us think previouly there are 5 rows that(files) were submitted to the database.I have to read the last 3 rows which were not submitted to the PBS previously.How can i flag the first 5 rows as they were read and submitted to the databse.

Please reply if somebody have some idea.

Thanks for your time and patience,
Rams.
0
ramsin
Asked:
ramsin
2 Solutions
 
Marv-inCommented:
i usually use a status field in my database - 0 by default so all new records will be 0

-then once you grab your status 0 records in your recordset
-create a string sql query on they fly so all the unique ids of the records will be in the where clause
-process your data
-update the records to a 1

0
 
crulxCommented:
You need to answer a few questions first to get a proper response.

Firstly, are you allowed to query the database you have submitted the files to? If so, and the files have a unique name or a unique key assigned outside of the database then you can search the database to see if your files have been submitted. If not, you will need to modify the original file or have a database yourself to record this information.

Do the files have unique names or an externally assigned ID? If they do, then you can easily make database queries or locally store the submitted information. If not, then you must create a unique key for the job files by either an MD5 hash of the file, combining the name and the date, or some other unique way of referring to that particular file.

Let me know a bit more about your situation to get further help.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now