Prem Wadhwa
Prem Wadhwa

Reputation: 1

Java method to run a .sh file

I am developing a requirement where i hit a button which calls a java method at backend(updates rows in db).

There are 2 lists. List A -->having more than 200000 records List B-->having 1000 records

List A is obtained by running .sh file which runs a query(select query where rownum<10) List B is directly obtained from DB.

If records from List B are present in List A then i update those records. Challenge faced here is i do not have jdbc datsource so i cannot obtain List A directly but via .sh file. Also, if i do not give rownum<10 then the execution takes more than 10 mins which is not acceptable.

so i need to execute the .sh file for first 10 records , compare it with List B, update the records if present in List A and then the same needs to be done for next 10 records and so on until all the records are compared.

Can you suggest something here? Please let me know in case of any info needed.

Upvotes: 0

Views: 88

Answers (1)

Thomas Banderas
Thomas Banderas

Reputation: 1739

I think that class ProcessBuilder would be better idea, you can put arguments and control process and this is preferred way by Oracle since 1.5.

As of 1.5, ProcessBuilder.start() is the preferred way to create a Process.

Upvotes: 3

Related Questions