Hello. I have a stored procedure that brings information from the database. The problem is when i close the window the transaction continues to work.

What can i do in my JSP and Java code to prevent this?

Does that mean that my transaction is wrong?

When the result data is not big, the transaction brings proper values. I mean it works well...

By "close the window" I assume you mean a browser? If so, forget it. The process is running on the server and closing the browser will not affect the currently running server process. With some clever use of JavaScript and/or AJAX (which is also, for the most part, JavaScript) you may be able to connect to the server and start some other process that may be able to disrupt the stored procedure, but don't rely on that.

Otherwise, if your process is simply taking a long time, then ask on an SQL forum for optimisation help.