Friday, February 28, 2003

Turning a JDBC Result set into a ColdFusion query

Recent discussion on the CFCDev mailing list (at cfczone.org) shows how to return a ColdFusion query object from a Java class using a JDBC result set (java.sql.ResultSet). The solution posed by both Brandon Purcell, and I was to pass your JDBC result set in to the constructor of the coldfusion.sql.QueryTable class. Joe Eugene tested the hypothisis, and asserts that it does work, but is slower then returning the result set, and navigating through using the methods of the ResultSet class.

The coldfusion.sql.QueryTable class comes with ColdFusion MX (this technique will only work on CFMX), and is located in the cfusion.jar file. You will need to add the cfusion.jar file to your class path before you can compile any java code that uses the QueryTable class (you don't need to worry about the classpath if you are accessing QueryTable via CFOBJECT, or CreateObject within CFML). More information can be found about the coldfusion.sql.QueryTable class here.

Some ColdFusion code to convert a result set to a Query object:

<cfset newQuery = CreateObject("java", "coldfusion.sql.QueryTable")>
<cfset newQuery.init( someObject.getResultSet() ) >

Some Java code to return a query from a java class (requres cfusion.jar in classpath)

import coldfusion.sql.QueryTable;
public class QueryUtil
{
  public static coldfusion.sql.QueryTable getColdFusionQuery(java.sql.ResultSet rs)
  {
    return new coldfusion.sql.QueryTable(rs);
  }
}

Thursday, February 13, 2003

More Info about ColdFusion MX on Redhat 8
Dustin Krysak contacted me in response to a recent blog entry ColdFusion MX works on Redhat 8. He me provided a detailed checklist for installing ColdFusion MX on Redhat 8, and allowed me to post it to cfdev: Steps Taken to Install CFMX on RedHat 8.

I should point out that Verity doesn't work on Redhat 8, and Redhat 8 still isn't officially supported by Macromedia. Steven Erat posted this message today on the CF-Talk mailing list "Just a word of caution, although most features of CFMX run on Red Hat 8.0, its not a supported version. The main problem is that binary files used in Verity won't work. There may be some other binary files used for other features and they won't work either."

Too bad verity isn't written in Java, maybe Macromedia can persuade Verity to do so (hint hint).

Tuesday, February 04, 2003

Disk Considerations on CFMX

When you install ColdFusion MX (in C:\cfusionmx\) with an alternate web root directory (lets say d:\web) the WEB-INF directory stays in c:\cfusionmx\wwwroot\WEB-INF\.

That isn't a huge deal but it has implications when you are using a different hard drive for your web files...

Lets say your C:\ drive is slower than the D:\ where you keep all your web files. All the generated servlets (class files), and CFC's class files will stay in the WEB-INF directory on the slower drive (C:\). Your also going to be taking up a lot of space on the C drive.

Many of the .class files will be cached, and you can set the cache size to be large enough to store all of them (in most cases). But when the server is restarted, the cache is lost. If you have tons of files access may be slower.

So unless you can figure out how to move the WEB-INF directory, your going to want to make sure that you install ColdFusion MX on a hard drive with enough space, and enough speed to handle your needs.