Results 1 to 6 of 6

Thread: Endless Loop in JdbcTemplate class with Oracle stored proc

  1. #1

    Default Endless Loop in JdbcTemplate class with Oracle stored proc

    Hi,

    I'm trying to execute a store procedure in Oracle. Every time I tried, my application hung while my CPU utiliztion remained high. I traced the problem to an endless loop which is occuring in the JdbcTemplate class.

    I then went and copied this code exactly:
    http://www.springframework.org/docs/...toredProcedure

    This code also results in an endless loop in the extractReturnedResultSets method. The code in the JdbcTemplate class:


    Code:
    	protected Map extractReturnedResultSets(CallableStatement cs, List parameters, int updateCount) throws SQLException {
    		Map returnedResults = new HashMap();
    		int rsIndex = 0;
    		boolean moreResults; 
    		do {
    			if (updateCount == -1) {
    				Object param = null;
    				if (parameters != null && parameters.size() > rsIndex) {
    					param = parameters.get(rsIndex);
    				}
    				if (param instanceof SqlReturnResultSet) {
    					SqlReturnResultSet rsParam = (SqlReturnResultSet) param;
    					returnedResults.putAll(processResultSet(cs.getResultSet(), rsParam));
    				}
    				else {
    					logger.warn("ResultSet returned from stored procedure but a corresponding " +
    											"SqlReturnResultSet parameter was not declared");
    				}
    				rsIndex++;
    			}
    			moreResults = cs.getMoreResults();
    			updateCount = cs.getUpdateCount();
    			if (logger.isDebugEnabled()) {
    				logger.debug("CallableStatement.getUpdateCount returned [" + updateCount + "]");
    			}
    		}
    		while (moreResults || updateCount != -1);
    		return returnedResults;
    	}
    When I run it, moreResults becomes false, while updateCount is 1, and the do while loop never terminates.

    Can somebody verify that this problem isn't exclusive to my environment?

    Thanks,
    -Dave

  2. #2

    Default

    Is it some sort of law that you'll find the source of the problem as soon as you post an inquiry to a forum? :roll:

    I swapped out our Oracle JDBC drivers. I think I had the drivers for release 1, not release 2:

    http://www.oracle.com/technology/sof...jdbc/index.htm

    Thanks,
    -Dave

  3. #3
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    This seems to be a feature of Oracle's 10g driver (driver version is 10.1.0.2.0). This is the most recent driver that is currently available for download.

    Funny thing is that the ojdbc14.jar that comes with WebLogic SP3 works fine and it reports the exact same version number. It is slightly different size though so it must be a different build. WebLogic's ojdbc14.jar is 1,353,229 bytes vs 1,352,918 bytes for the one downloaded from Oracle's OTN site.

    I'll have to do some more research into this. What version did you use when you hit this?
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  4. #4

    Default

    Quote Originally Posted by trisberg
    This seems to be a feature of Oracle's 10g driver (driver version is 10.1.0.2.0). This is the most recent driver that is currently available for download.

    Funny thing is that the ojdbc14.jar that comes with WebLogic SP3 works fine and it reports the exact same version number. It is slightly different size though so it must be a different build. WebLogic's ojdbc14.jar is 1,353,229 bytes vs 1,352,918 bytes for the one downloaded from Oracle's OTN site.

    I'll have to do some more research into this. What version did you use when you hit this?
    It seems I was using Oracle's 10g drivers. I had thought that I had the 9.1 release - seems I need to pay more attention to what drivers I'm using.

    The 9.2 drivers work fine, though I suppose you knew that. The JAR file which was creating problems for me is the 10g build you were referring to (1,352,918 bytes).

    Thanks,
    -Dave

  5. #5
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    This is indeed a published bug in the Oracle 10.1.0.2 driver. (Bug #3563038 from May 19, 2004) where Statement.getUpdateCount() returns 1 instead of -1.

    It is fixed in 10.1.0.3 (part of server patch set) and will also be fixed in 10g Release 2.

    It also appears to be fixed in the 10.1.0.2 version distributed as part of WebLogic 8.1 SP3.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  6. #6

    Default

    Quote Originally Posted by trisberg
    This is indeed a published bug in the Oracle 10.1.0.2 driver. (Bug #3563038 from May 19, 2004) where Statement.getUpdateCount() returns 1 instead of -1.

    It is fixed in 10.1.0.3 (part of server patch set) and will also be fixed in 10g Release 2.

    It also appears to be fixed in the 10.1.0.2 version distributed as part of WebLogic 8.1 SP3.
    Thanks for the info,
    -Dave

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 3
    Last Post: Sep 4th, 2005, 11:11 PM
  5. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •