ROWID with Oracle thin clinet datasource

In one of my CF project I was using my datasource with JDBC driver from CF admin. But recently, I have upgrade my webserver to Weblogic 12c as well as I have start using my all datasource with Oracle thin client driver from Weblogic Console. Most everything is working, however, there was one section of legancy code where I got error.

This error is related to a column named ‘ROWID’ which is a built in ‘column’ in Oracle that returns a unique value for each row in a database. Its king of like a UUID. When I did a <cfdump> of the query, I noticed that the value of the ROWID column was not a string, but a Java object of type ‘oracle.sql.ROWID’.

Here is a snapshots of <cfdump> of my query:

Recent, I was using my datasource with JDBC driver from CF admin and that time I noticed that the value of the ROWID was string. Here is a snapshot of the <cfdump>:

As off now to overcome this issue, In my query I have just used in built function of Orcale ‘rowidtochar()’ which converts the rowid value to string value and I got the string value in my query object. But still I think that this is not a proper solution because I need to do this change every where I’ve used ‘ROWID’ in my project. There may be some settings with Oracle thin client driver that I need to do. Anyone have any idea about this please share……

All in all, a lot of time was not wasted on this issue, but it does bring an important point to light. When you are dealing with any upgrade or going to use any different environment, you need to be aware of how those different environments might behave – such as what is returned from a query.

application.cfc / cfm not working – Linux Only

Recently, I have moved one of my ColdFusion website from windows server to Linux hosting server. And I got the error that variable ‘Application’ is undefined. I have checked whole my application.cfc and can’t got the issue first but after sometime I remember that the issue with linux server and my application.cfc file name.

If you are using ColdFusion on Linux based servers and have an application.cfm/cfc that is not defining the variables and settings with your ColdFusion code then just you need a capital ‘A’ on the file name shown below:

CORRECT:
  • Application.cfm
  • Application.cfc

INCORRECT
  • application.cfm
  • application.cfc
If this still does not work make sure to check your permissions on the file are set to be readable. You can always contact the support team if you require any assistance.

REST services in ColdFusion 10

RESTful Web Services are becoming increasingly popular mostly because of their simplicity and ease of use. You can access RESTful Web Services easily over HTTP/HTTPS. ColdFusion 10 provides support REST services. You can easily expose your ColdFusion Component (CFC) as a RESTful Web Service through a few attributes you specify within your CFC.

Some new attributes are added in ColdFusion10 to help you create a REST service to the following ColdFusion tags: cfcomponent , cffunction , and cfargument . Once you create a component and register it with the Administrator, you can access it via a HTTP request.

First, specify the rest attribute as true within the CFC, along with the restpath attribute, which specifies the path of the service accessed over HTTP. On every function in the CFC it is possible to associate the HTTP method that should invoke the corresponding function.

For more information: click here – There is such a nice article by Sagar Ganatra regarding how to getting started with REST services in ColdFusion 10.

Form Fields with the same name – ColdFusion 10

In ColdFusion when you submit form, and the form contains multiple form fields with the same name (a list of checkboxes, for example) that these values will be available to us as a comma-delimited list in the FORM scope.

ColdFusion 10 gives us the ability to transform these lists into arrays automatically. It is as easy as adding the following to Application.cfc


this.sameformfieldsasarray = true;

Now, anytime you submit a form where more than 1 form field share a name, the value of FORM.{fieldName} will be an array instead of a list.