I think I understand now what you tried to do. You tried to follow this guide
https://wiki.apache.org/db-derby/DerbySQLroutines#Creating_Procedures but missed out some important details
Your
java stored procedure should be in its own class and method, packaged in its own JAR, and declared to derby. Read the articles under
https://db.apache.org/derby/docs/10.12/devguide/cdevdeploy23812.html on how to do this.
Derby then executes this java method when CALLed, passing it a pre-created ResultSet data[] array. You just have to run your query and copy its resultset into that array.
Currently, what you seem to have done is included the code of the stored proc too into the client app's action listener. That's not how Derby stored proc works. Follow that guide carefully, and
you should be good to go.
But before all that, ask yourself if you really need a stored proc at all for such a simple query.