troubleshooting Question

Exception while calling the execute function of CallableStatement

Avatar of makeshkumar_r
makeshkumar_r asked on
Java
13 Comments1 Solution999 ViewsLast Modified:
My application is running for a while. Usually 2 weeks once , we get the exception in JDBC call and we restart the application and it runs fine. Finally we found the source of the exception. It's from execute() method of callableStatement. The call returns exception. But there is no information in the exception object. The getMessage() function of Exception returns null and there is no stack trace.

The callableStatement execute() is being called continuously to get the record one by one. This functionality is coded in Servlet.
statement = connection.prepareCall( "{ CALL procName(?) }" );
           
            do
            {
                try
                {
                        count = new BizDelegateDBUtility().getInprogressCount(tableName);
                        
                        if(routerMsgCount>=0) 
                        {
                            if(count > (routerMsgCount+1)) 
                            {
                                routerStatus = "stop";
                                break;
                            }
                        }
                        
                        if(count ==0 ) 
                        {
                            introduceDelay = false;
                        }else 
                        {
                            introduceDelay = true;
                        }
                        
                        int currentCount = 0;
                        while(currentCount < ( routerMsgCount - count)) 
                        {
                            this.deQueue(connection,statement,tableName);   
                            currentCount++;
                        }
                        if(introduceDelay) 
                        {
                            Thread.sleep(waitTime);
                        }
                }
                catch(Exception exception)
                {
                        //   Logging error message
                        routerState++;
                }
            }
            while(routerState==1 && !(routerStatus.equalsIgnoreCase("stop")));
 
	private  void deQueue(Connection connection, CallableStatement statement,String tableName)
	{
        
        long runSeq;
        boolean retrun = false;
        try
        {
            statement.registerOutParameter (1, OracleTypes.INTEGER); 
            retrun = statement.execute();
            runSeq = statement.getLong(1);
            if(!statement.wasNull())
            {
                new BizDelegateDBUtility().updateGroupFlagHistoryStatus(runSeq,"IN PROGRESS",tableName);
                consultQManaggerNSend(Long.toString(runSeq));
                waitCount = 0;
            }
            else
            {
                    Thread.sleep(waitTime);
                    waitCount++;
                    if(waitCount < 3)
                    {
                            sLogMessage = "Waiting for Message from DC...";                        
                            //   Logging message
                    }
            }                                        
        }
        catch(SQLException sqlE)
        {
		//   Logging error message
        }
        catch(InterruptedException interruptedException)
        {
               //   Logging error message
            
        }catch(Exception exception)
        {
            //   Logging error message
        }
    }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros