users@glassfish.java.net

Hang when calling stored procedure

From: <glassfish_at_javadesktop.org>
Date: Fri, 05 Jun 2009 02:32:37 PDT

I have a webservice running on glassfish that is calling an oracle stored procedure. Clients make about 30-50 request per second on that webservice.

The problem is that only 2-3 calls can be made to the webservice before glassfish hangs (can't even login to the console). When I do not make the stored procedure call, everything runs fine.

Is there something wrong with my code:

        public void callStoredProcedure(String param)
        {
                Connection cnx = null;
                try
                {
                        InitialContext ctx = new InitialContext();
                        DataSource ds = (DataSource)ctx.lookup("jdbc/mandplbs");
                        cnx = ds.getConnection();
                }
                catch(NamingException ex)
                {
                        ex.printStackTrace();
                }
                catch(SQLException ex)
                {
                        ex.printStackTrace();
                }
                
                if(cnx != null)
                        try
                {
                                String sql = "{call mandplbs_test_proc(?)}";
                                CallableStatement stmt = cnx.prepareCall(sql);
                                stmt.setString(1, param);
                                boolean results = stmt.execute();
                                do
                                {
                                        if(results)
                                        {
                                                ResultSet rs = stmt.getResultSet();
                                                rs.close();
                                        }
                                        System.out.println();
                                        results = stmt.getMoreResults();
                                } while(results);
                                stmt.close();
                }
                catch(SQLException ex)
                {
                        ex.printStackTrace();
                        logger.debug("Uncaught exception", ex);
                }
        }
[Message sent by forum member 'masrudyn' (masrudyn)]

http://forums.java.net/jive/thread.jspa?messageID=349273