ColdFusion 8: CFPROCPARAM update
Bookmark and Share
 

Posted by Rahul in

The behavior of 'dbvarname' attribute of <cfprocparam> tag is changed with ColdFusion 8. The attribute is now *used* on the contrary to ColdFusion 7. The documentation for ColdFusion 7 says

Changed the dbvarname attribute behavior: it is now ignored for all drivers. ColdFusion MX uses JDBC 2.2 and does not support named parameters.

Since ColdFusion 8 now supports JDBC 3.0, one can pass arguments to a stored procedure in any order by using dbvarname attribute. In earlier versions of ColdFusion we had to pass the attributes in the same sequential order as they are declared in the underlying stored procedure.

One thing to take care about is either you specify the dbvarname for all the parameters or none at all (in which case the parameters will be passed sequentially to the stored procedure. We just encountered a few procedures in our old applications, which were throwing errors as they had mixed usage of dbvarname i.e some parameters had dbvarname and some didn't which will fail in ColdFusion 8.

Update: Hemant Khandelwal, ColdFusion Engineering Manager just updated (see comments) that the changes to the dbvarname I talked above have been rolled back for the final release of ColdFusion 8. This means that the behavior of dbvarname will continue to be the same as ColdFusion 7. Thanks Hemant for the update.

12 comments

Really, cause we use 7.0.2 and an error message was encountered when the spelling of the dbvarname was different that what we had in the stored procedure.

7.0.2 revived the dbvarname attribute.

dbvarname was added in ColdFusion MX 7.0.2 Cumulative Hot Fix 1 item 52712

I was under the impression that dbvarname was removed in cf8....

CF 7.0.2 onwards JDBC 3.0 was supported & dbvarname was added but with CF8 validation of dbvarnames is added

Unfortunately, we have backed off the changes for dbvarname. We tried supporting this in private beta of Scorpio but encounter lot of issues in supporting different db/driver combination.

In the final release of CF8, dbvarname will continue to be ignored and the behaviour will be same as CF7.

Thanks,
Hemant
Adobe ColdFusion Team

Ok, so it was put back in at 7.0.2 and then will be removed with 8. Why remove it again if it was already in the code base for 7.0.2?

Hemant,
That really creates a problem. When it was added back into 7.0.2, we tweaked our code so we could use dbvarname. We have a couple of SPs that have a ridiculous number of params. I hate calling that thing with a bunch of empty params.

So what's the final word on this? As far as I can tell there have been changes made.

Here's the error we're getting:

Found dbvarname="@stdaddress". The dbvarname attribute, if used, must be present with each cfprocparam tag of the stored procedure.

The exact same code works fine in CF7.

I'd like to comment that I've put in quite a few forum entries and talked to various people at adobe who assured me this would be fixed by release time. Unfortunately it isn't, and is quite frustrating. We have thousands of pages that don't specify dbvarname for out vars, and it is nearly impossible to fix all the pages that contain those errors. I'm hoping a hotfix will show up soon.

Gary Fenton   says 5/21/2008 7:58 PM

I remembered that 7.02 and CF8 beta were going to support dbvarname so I just updated some of my code and got errors, Googled for help, then came across your blog.

Very disappointed that dbvarname isn't supported. This means that when a DBA adds a new param in an SP, CF will throw errors. Sometimes a SP has to be changed to support other purposes, CF isn't always the only client of a database.

So what's the solution? The DBA has to tell the CF guys about the change in advance and everywhere the SP is called in the app will have to be modified then tested. It's a crazy way of working. Hopefully Adobe are working on supporting dbvarname in a future release.

As FYI,

Right now, over a year after Hemant said this had been rolled back in CF8, I am having this issue as we upgrade.

CFPROCPARAM does NOT work like it did in CF7 (at least for Oracle). We are getting errors related to missing dbvarname parameters that were used by a contract developer with CF7. They worked without issue until we upgrade and now I am having to go back and remove them.

So CF developers should still take caution to this behavior when developing and upgrading.

That is ridicules to have to omit the dbvarname. Currently using CF7 and noticed that the multiple cfprocparams have to be called in the same order as my SQL Stored Procedure has it. I kept the dbvarName on there as well. Just seems like the neat way to do it and hopefully can be addressed in a hotfix for 8 before upgrading. Can someone clarify that you can not have the dbvarname attribute in CF8 or it doesn't work.

Post a Comment

About Me

My Photo
Rahul Narula

Application Architect Webteam@Adobe

View my complete profile

Subscribe via email

Enter your email address:

Live Traffic Map

  Powered by Blogger

Twitter

Archives