The Evil Side of Maintain Database Connections and Stored Procedure Errors

A word of caution. When working with Stored Procedures in a development environment, do yourself a favor and untick the 'Maintain Database Connections' option.

If a stored procedure call results in an error, Maintaining Database Connections will sometimes cache the error and hand it back to you regardless of how the call is altered. These are very annoying symptoms to debug! In fact, when I first figured this out, I had already spent 4 hours the previous day combing through an Oracle stored procedure for any possible error when I logged in fresh at 8AM to find the process magically working. I felt like I was on Candid Camera. When I dug deeper, I found unticking 'Maintain Database Connections' would allow my SQL Stored Procedure calls to process fresh each time.

So you can pull out your hair if you want to, or you can untick Maintain Database Connections in your development environment.

A note, the Maintain Database Connections setting is under the Advanced Settings for a specific Datasource configuration. As far as I know, you will have to alter every datasource individually.

Comments
Often just setting "Max Pooled Statements" to zero will fix this, without the performance penalty of un-checking "Maintain Connections".
# Posted By TomD | 8/10/07 1:24 PM
I wonder if this is a database/driver specific issue have you seen this with any other databases?
# Posted By kola | 8/30/07 9:50 AM
Kola,

Its happened to me on Oracle and MSSQL 2005 for sure. I don't recall whether I ran into the issue on Postgres or DB2 systems.
# Posted By Dan Wilson | 8/30/07 10:40 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.001. Contact Blog Owner