ColdFusion 11 and dbvarname attribute

First, some background.

dbvarname is an attribute for cfprocparam to specify named parameters while calling a stored procedure. For details refer https://wikidocs.adobe.com/wiki/display/coldfusionen/cfprocparam

Versions prior to ColdFusion5 had support for dbvarname. This was deprecated in ColdFusion MX, brought back in 7.0.1 and deprecated again in 7.0.2. The reason was the lack of proper support from multiple jdbc drivers. Since then, this was a major ask among ColdFusion users.

ColdFusion 11 brought this attribute back from the dead. It was disabled by default with a flag to enable it. ColdFusion 11 update 3 enabled it by default. Databases need a variable prefix for named parameters. (eg:- “:” for Oracle and “@” for SQLServer). If the database is SQLServer, it should be dbvarname = “@param1”. This will break applications which were using this attribute without the prefix because this attribute was being completely ignored in prior versions. So to give some time for customers who don’t want to change their code, in update 4 we introduced a flag to disable dbvarname.

-Dcoldfusion.ignoredbvarname=true jvm flag can be used to disable dbvarname attribute. This flag is only for CF11 and not for later versions.

Having to change lot of code is not pleasant but we believe that is the way forward.

Application datasources in ColdFusion

Reproduced from original post here.

Datasources in ColdFusion have always been defined either in CFAdmin or through Admin API. This made it difficult for applications to be portable across ColdFusion servers.

CF11 brings application specific datasources to ColdFusion. With this, applications can register their own datasources (when they start) without messing with the server-wide datasources defined in CFAdmin. The datasource details can be defined in Application.cfc

Syntax:-

————

  • this.datasources.derbyds={ driver=”Apache Derby Embedded”, database= “C:/dev/ColdFusion/cf_main/cfusion/db/artgallery/”};
  • this.datasources.dsn1={“database”=”regression”,”host”=”localhostMSSQL2008″, “driver”=”MSSQLServer”, “username”=”sa”, “password”=”password”};
  • this.datasources.dsn2={“driver”=”MSSQLServer”, url=”jdbc:macromedia:sqlserver://localhostMSSQL2008; databaseName=regression; sendStringParametersAsUnicode=false; querytimeout=0; MaxPooledStatements=1000″, “username”=”sa”, “password”=”pass”};
  • this.datasources.customDSN = { “driver” = “other”, “url” = “jdbc:sqlserver://localhostMSSQL2008; databaseName=pubs; sendStringParametersAsUnicode=false”, “username” = “sa”, “password” = “password”, “class” = “com.microsoft.sqlserver.jdbc.SQLServerDriver”};

If you are using a custom driver, you can use the last syntax given above and specify the driver class.

If you are using drivers shipped by ColdFusion, you can specify the driver and the corresponding driver class will be picked up by ColdFusion.
Possible values for driver are all provided in neo-drivers.xml.

Note: If there is a server-wide datasource with the same name as application datasource, the latter will be picked up.

CFZip Enhancements in ColdFusion Splendor

CFZip has been in ColdFusion since CF8 but it was only for unencrypted zip files. ColdFusion Splendor brings password protection to CFZip with multiple encryption methods. 2 new attributes have been added to CFZip and CFZipParam to support this functionality.

Password

EncryptionAlgorithm  <Standard, AES-128,  AES-256 (default)>

 

Examples

cfzip(action=”zip”, file=”C:ZipTesttestzipfile.zip”, source=”C:ZipTestsample.txt”, password=”pass”);

cfzip(action=”list”, name=”zipFileList”, file=”C:ZipTesttestzipfile.zip”);

cfzip(action=”unzip”, file=”C:ZipTesttestzipfile.zip”, destination=”C:ZipTest”, password=”pass”, overwrite=”true”);

More examples here.