An abnormally long running JDBC query executed by an application may leave it in a hanging state unless a timeout is explicitly set on the statement. Setting a statement timeout guarantees that all queries automatically time out if not completed within the specified period. When statements are created, the queryTimeout is set according to the statement timeout setting. This works only when the underlying JDBC driver supports queryTimeout for Statement, PreparedStatement, CallableStatement, and ResultSet.
You can specify a statement timeout in the following ways:
Enter a Statement Timeout value in the JDBC Connection Pools page in the Administration Console. For more information, click the Help button in the Administration Console.
Specify the --statementtimeout option in the asadmin create-jdbc-connection-pool command. For more information, see the Sun GlassFish Enterprise Server v3 Prelude Reference Manual.