Aug
10
Cached errors using CFQueryParam

I was working on a project today and ran into this error

[Macromedia][SQLServer JDBC Driver]Value can not be converted to requested type


I did a quick search found a lot of theories on why and how it was caused. So it turns out it's a caching error, by default ColdFusion data sources pool 1000 statements, but how to fix. Almost all suggested restarting CF, which I cannot do, change the dsn name open page to error and then change back, or my favorite: "When in doubt kick it in the guts (restart JRUN)". They all work but not the best way to handle the error.

Easiest and best way to get rid of this error is to log in to CF Admin, click Data Sources, find your data source and click it then click Show Advanced Settings. Update "Max Pooled Statements" to zero, click submit, then run page. Now you can change it back. This removes the cached SQL select statements with out resetting connections to users.



 
3 Comments [add comment]
This may or may not be an issue also but I have heard if you use cfqueryparam, all your where clause values should be cfqueryparam.

Mike Henke - Tuesday, August 10, 2010
Yep all my where clauses use cfqueryparam, I think it's more the structure of the query being cached. Seems once I change anything through the SQL server manager I get that error.

John Ramon - Tuesday, August 10, 2010
Super helpful, thank you for taking the time to post!

Shane - Friday, October 08, 2010