I agree with the responses above there are many ways a SQL statement can be invalid as well as giving a users access to execute raw SQL statements can be destructive to your database.
if you must go this route. I would suggest you provide a series of drop down lists where you have more control on what the users can query i.e. table, columns and only queries of the database, no insert or updates if possible.
Updates and Inserts can be handled by another JSP (form) page where the user will enter information to be added to the database.
Once the users make their selections you will put everything together and build the SQL statement behind the scenes.
I would be careful when you "grep" for just for java. It may return other processes that use java.
Also when you execute the command 'grep java'. The actual command 'grep java' will show up in the process status queue.
One suggestion is to grep for the script that will execute the java program. This will only work if the script blocks while the java program program is running.
You should use binary mode, otherwise when you transfer the file to a windows environment, there is good possibly carriage returns<cr> will be added to the contents of the file.
The way I undersand it the symbol pipe "|" is used to send the standard output of a command to the left of the pipe as standard input to a command to the right of the pipe.
You cannot use "|" to create files like ">". Which is used to redirect standard output to a file.
The "|" is used to redirect standard output of a command to another command not another file.
But you should reference your data by using the following:
Also, you should insert code to close your resultSet when finished:
Also you are not saving your bean or passing it back to the calling program:
When you exit the while loop your bean is out of scope. One suggestion is to save each individual bean in a collection and then return the collection to the calling program or your jsp page:
Once you return your bean to the servlet you can iterate through the collection and place the bean in the jsp page scope for display.