Saturday, September 07, 2002

Wondering about your java configuration running under CFMX?

If you've wondered about various settings of the Java environment configuration you've got running under CFMX--such as what the classpath is, what version of the JVM is running, you can easily see that using the CF Administrator. No, I don't mean by going to the "Java and JVM" settings page. That's where you can modify these things. I mean the "version information" link that's at the top of the administrator.

There's a wealth of info there, about both the Java and CF environments (such as CF Version and license info). Of course, the JVM info there is info you can get from the JVM itself if you know how to do so, but it's nice to know you don't have to.

And though you may think that the "Java and JVM" settings page in the admin tells the same thing about the JVM and the classpath, well, first there's a lot more on this "version" page than just that. Second, the "Java and JVM" page may show the location of the JVM, but it doesn't tell you what version of the JVM it is. Finally, though it lets you enter info in the "class path" field, what you may not realize is that there is already info in the classpath even before you enter a value there.

What if you don't have access to the CF Administrator? Again, if you know how to, you can find some of the JVM info on the command line in that the JVM's directory (using "Java -version" for instance).

But you can also find things out if you know how to use the Java system library API. If that sounds foreign, don't worry. Just save the following script as getversion.cfm in a web directory of CFMX and run it:

<cfset sys = createObject("Java", "Java.lang.System")>
JVM name: #sys.getproperty("")#<br>
JVM version (build): #sys.getproperty("Java.version")# (#sys.getproperty("Java.vm.version")#)<br>
JVM class path: #sys.getproperty("Java.class.path")#<br>

When I ran this on my machine, I was surprised to see that CFMX's built-in JVM is running the HotSpot compiler. That's good to see.

And the classpath had much more than just what I may have entered in the JVM Path in the administrator (actually, this is not new. CF 4.5 and 5 did that as well.)

Friday, September 06, 2002

More details on configuring the built-in web server in CFMX

In an Aug 15 entry I wrote about how you could configure the built-in web server in CFMX to support your accessing code outside the built-in wwwroot. There's a very interesting article in the MM support center, Configuring the Macromedia ColdFusion MX built-in web server, that goes into much more detail on this and more. Definitely worth checking out.

Indeed, note that they show an example of configuring a virtual mapping for \* which can effect a replacement of the location of the default webroot. I had discussed it just for adding additional paths outside the default root. Clearly, both uses have their place.

Understanding and Setting up Resource/Sandbox Security

If you've wondered about CFMX's new Resource/Sandbox security feature--or especially if you have no idea what it is, or think it doesn't apply to you, you should check out my two articles just posted in the new Macromedia Security Development Center. I think every developer and administrator ought to understand these features, as well as know the difference between Resource Security (in Professional) and Sandbox Security (in Enterprise).

It's all much more straightforward than Advanced Security was in CF4 and 5. Plus, it extends greatly what Basic Security offered in those releases.

Plus, beware that if you had setting for Basic Security in CF4 or 5, those are NOT automatically migrated into the new security controls in CFMX. You have to create the controls anew in CFMX. The articles fully explain how to understand and setup these new features.

The articles titles are:

Wednesday, September 04, 2002

Fun with Filters and Listeners

Among the cooler new things in CFMX, which becomes available to us by way of the underlying J2EE engine, may be the concept of filters and listeners.

In the JSP/servlet world, these are discussed as a means to provide some sort of global functionality to your applications. Now we can use them with ColdFusion as well.

This first discussion will focus on filters. These could allow every request to your application (or a part of the application) to cause something to be done before running the requested page. In a way, this may seem much like CF's application.cfm.

The filter might make a decision about what template to execute as a result of analyzing the characteristics of the request (the ip address or user agent of the requester), or it might even modify the incoming request data.

And just as we have onrequestend.cfm which can cause some code to execute before a page is returned to the user, filters in jsp/servlets can also be used to do post-processing for them. It might modify the output before sending to the requester, or it might block it entirely.

Now with CFMX, we can use filters with CF templates.

Examples of how you might use them include authentication, logging and auditing, image conversion, data compression, localization,
XSLT transformations of XML content, encryption, caching and more.

You can learn more about filters at There are also articles on listeners O'Reilly and Java Boutique, as well as a chapter in More Servlets and JSP by Marty Hall.

While the focus of most discussions in JSP/servlet articles and books is on how to create such filters, the fact is that you may find one created by someone and available on a public repository of them that already does something interesting for you.

And we as CF developers don't really need to know any Java (or even understand servlets or JSP) to be able to leverage a filter that someone else has written.

There are repositories of filters at various places. One of them is the ColdJava suite. This really has nothing to do with ColdFusion, despite the name.

In a later article, I'll walk through the process of using one of these, but with this pointer to where to learn how to work with them, and where to find them, many will have enough to figure things out on their own.

Before concluding, I had mentioned that another new JSP/servlet concept available to us was "listeners". There are two kinds of listeners, application and session, which can act as triggers that can cause execution of a program when an event takes place in the application or session contexts.

Now, the application and session contexts, as well as the programs that can be fired in response to events, would all be Java ones. What does that mean to us? Well, again, Java code may already exist. Further, we can setup the CFMX environment to use listeners for the application and session contexts just as with JSPs or servlets.

In a later blog entry, I'll show some practical applications of using filters and listeners in CFMX.

For now, you can learn more about listeners and the "servlet life cycle" on your own at O'Reilly and Sun.

Tuesday, September 03, 2002

Using JSP Custom Tags in CFMX: Why You Should Care

In ColdFusion MX, it's now possible to use JSP custom tags. But what does that mean to you? Well, you don't need to know Java (nor understand JSPs) in order to use tags. They're very easy to use, and libraries with hundreds of them are available to the JSP world.

There may be solutions that you could use that have been created as JSP custom tags, and they're very easily made available to you in CFMX in just a few simple steps.

I explained this in my May 2002 CFDJ article, "Using JSP Custom Tags in CFMX: What, Why, and How ". You can read it, and all my articles, online at

I also will be covering the topic in my Macromedia DevCon talk, "Incorporating JSP Custom Tags Into Your ColdFusion Apps" (

I'll also post a couple of specific and interesting examples in later blog entries. Finally, one of those will also leverage a couple of very unheralded features in CFMX which comes to us by way of the underlying J2EE server: filters and session event handlers.

When SQL Functions make sense

Did you know that there are SQL built-in functions, just as we have CF built-in functions? Indeed, have you ever wondered when you should use one or the other?

In usin SQL functions, you're saying you wants the SELECT statement that's passed to the DBMS to have the function passed along with it (not the value of the function, but the function itself) so that the function is executed by the DBMS before the results are returned.

Sometimes, the intention is to simply convert the output being returned in some way, as in to lower case is. In that case, you could do something like this:

<cfquery ...>
Select column1 from MyTable

<cfoutput query="">

But an argument can be made that asking CF to do this post-processing of the output is something you should avoid, if you can ask the DBMS to do it for you. If you could use the DBMS's built-in function you could instead do as he did in the first example above and say Select ucase(column1) or Select upper(column1), depending on the DBMS. That would take load off of CF and put it on the DBMS.

Now, it may seem that the approach is splitting hairs. The output is the same either way, so why worry about SQL functions at all. But what if instead you wanted to execute a function that altered the way that the search results were found?

For instance, consider a column called startdate. What if what you wanted to find only those records whose startdate was this year? While you could do some date range comparisons on the select, or (worse) just select all the data and search though it using CF functions, you could very easily (in some databases) use where year(startdate) = year(now()).

While those may look like CF functions, they're all SQL functions. While you could replace the right side of the equal sign with the CF functions (wrap them in pound signs), you couldn't do the same with the left side. That would create a value that's passed to the SQL, when instead you want to operate on the data in the database.

So SQL functions do indeed have their place.

In the previous entry, I provided some reference to finding out more about SQL functions.

SQL Function reference

Ever tried to recall a SQL function? There's a nifty reference to them in the form of Chapter 4 of "SQL in a Nutshell" available at It covers Microsoft SQL Server 2000, Oracle 8i, MySQL, and PostgreSQL 7.0.

Another exists at in the form of an appendix regarding the JDBC driver from datadirect. But it lists available functions for DB2, Informix, Oracle, SQL Server, and Sybase.

I've not found a good reference of them in Access. If anyone can recommend one, please let me know.

Notes on the SAP DB installation

Someone asked me how the installation of SAP DB went, after they read about it in a previous blog entry. That reminded me that I had wanted to add a few more notes to help folks interested in trying it out.

Well, the install wasn't too painful, though I guess that's a relative term. I had thought about commenting on it in the previous entry, then I figured that anyone who's worked with other open source DBMS's will be used to quirks. Still, since he asked, here are some observations, and on more than just the install itself. I can certainly understand one finding challenges. Hope this will help. I did it on a Win2k system, and some of the quirks were:

- the downloadable file at was a ".tgz" file (compressed "tar" file), rather than a .zip file. Still, winzip recognized it and opened it.
- I couldn't run the sdbinst.exe install program from within winzip, because it expected to leverage a perl.dll also in there. I simply extracted those manually to a single directory and ran it from there, no problem.
- it doesn't create any sort of "start>programs" kind of entry, which can be confusing to some.
- the service it installs (SAPDB) is not set to start automatically, so you have to start it manually or choose to have it start automatically

From there, you need to also download the odbc and/or jdbc drivers, which is all you really need. The odbc install executable worked fine for CF5, with a caveat: it didn't show up in the CF Admin's list of datasource driver types, but I could create it in the ODBC Data Sources dialogue in windows, where it showed up as "SAP DB 7.3" or "SAP DB 7.3 Web", depending on which you downloaded. I didn't see any obvious difference between them. So while you can't add new DSNs in the CF Admin, you can edit them once added this other way (though the CF Admin datasource edit screen indicates some limits in what it will allow you to edit about the DSN properties). I just added that info to the Blog entry.

In MX, as I discuss in the blog, there were a couple steps needed. Again, I don't think they're any different than for any other DBMS, but admittedly most don't bother adding new JDBC drivers, so that takes some experience (but I explain how in the blog entry, also added since the very first version I published).

That's all one really needs, but it will be helpful for most to add the database manager and sql tools. There are 2 types for each, web-based and desktop/Gui. The desktop/Gui versions are only available on Windows, but most things can be done in the web-based tools.

There's also a means to setup a first demo db, at A couple of quirks there are that, for one thing, it tells you to run a ".cmd" file which may be confusing to folks who don't recognize that file type. It's a "windows NT command script", but it works just like a batch file. Just run t from the command line in the directory it tells you to. Also, the page lists an available dbm/dbm username/password pair, but they didn't seem to work. The listed test/test and dba/dba did work ok. Also, once installed, this sample db doesn't have any "real" tables of data. It's all a bunch of system tables (as I saw from within Studio's database query tool). Guess it's more of a skeleton.

Once I added a new table with the "SAP DB SQL studio" tool above, that was then accessible from CF (including Studio). In fact, I found that CF Studio's db tool changed from listing all the system tables to listing just the "real" table(s), once I added some.

Oh, and how did I add a table? Of course, one could do it via DDL (Create Table) SQL statements from within CF, once the dsn is defined. But the SQL Studio tool allows you to right-click on its "tables" option and choose "new". From there, it's much like creating one in SQL Server or Access. I couldn't figure how to do it through the web-based tools, though.

That leads to the docs. I tried to find out how to do that in the docs, but I couldn't find it. I have to admit that the docs don't have any sort of "how to get started", so I've written all these notes. There's not any book written on the market either, from what I can tell (hmm, I smell an opportunity). There are quite a few docs. They're not perfect. When I said in my previous blog entry that they were "professional", I was being influenced more by the installation guides, where were pretty organized and seemed to anticipate one's questions at each step.

I should add too that one other quirk there is that the links to the docs offered on some pages (such as the URL mentioned in the next paragraph) will link only to the "Reference", which really isn't what you'd want to start with at all. Instead, go to and choose the docs from there, available both as HTML and PDFs. Most will want to start with the "user guide" (and the "installation guides", of course), as well as the docs on the dbm (manager) and sql (query) tools.

Finally, I should add that there's a nice single page listing all the software needed (for all os's) at (there's also a list at, but it doesn't list all the tools).

I have to admit, though, that an even stranger curiosity was that when I'd click the links for these software download links, nothing would happen. I thought it was a transient problem, but after trying several times over a long period, I finally noticed that they were in an FTP directory, so I grabbed them with an FTP client instead of the browser.

I suppose all these things might keep some from being able to make the leap. I suppose it depends on how much someone is willing to work through the challenges. In any case, I hope that now this compendium of observations helps folks.

I mean, it really seems to be an enterprise-strength DBMS that's free for deployment. I know licensing cost is only a small part of the equation, but having got over these humps, it looks like all the benefits of the tools are now readily available to us.

As for speed comparisons, I haven't seen any, but the few discussions I've seen about it have implied that it's speedy and scalable. I guess I'm opening the doors to a larger audience of people to hear more about what folks may find out. Hey, it's free. It's worth a try.

Monday, September 02, 2002

Looking for a Robust Open Source DBMS? Looked at SAP DB?

I know a lot of people are looking for low-cost alternatives to the major DBMS's out there (Oracle, SQL Server, DB2, etc.) While some know MySQL, PostgreSQL, Inprise/Firebird, and others to be popular and often adequate options, others point to their challenges in scalability (their threading/connection models won't support very large numbers of concurrent connections).

There's another OpenSource alternative out there, and it's one that many may not have noticed (or may even dismiss due to its name): SAP DB, at It's from the same company that created the enterprise system SAP R/3, and it has its roots in the Adabas enterprise DBMS.

Even if you're not an SAP customer, you should give it a look. It offers all the robustness and features of enterprise DBMS, yet is fully SQL-92 compliant. It runs on Windows and *nix, includes ODBC and JDBC drivers (and more), offers a web-based tool interface (supporting IIS, Apache, or their own web server), a SQL Studio tool for windows, and lots, lots more.

And yes--it supports stored procedures, triggers, transactions, and more. It is truly client-server, supports very large databases, and lots more. The docs are professionally done and there's available support (both self-service and paid). There are tools for managing the databases and environment (the dbm tool) and for creating queries (sql studio), and both of those are available both as web interfaces or desktop clients.

Best of all, all this is absolutely free--even for deployment.

I've been able to use it with CF5, by way of it's available ODBC driver (also free). It didn't show up in the CF Admin's list of datasource types, but I could create it in the ODBC Data Sources dialogue in windows, where it showed up as "SAP DB 7.3" or "SAP DB 7.3 Web", depending on which you downloaded. I didn't see any obvious difference between them. So while you can't add new DSNs in the CF Admin, you can edit them once added this other way (though the CF Admin datasource edit screen indicates some limits in what it will allow you to edit about the DSN properties).

For CFMX, it works as well, but not using the "odbc socket" driver type. Instead, you need to use the "other" driver type offered. I followed these steps:

- save the downloaded sapdbc.jar to cfusionmx\lib
- in the admin dsn definition, select "other" for driver type
- in the screen that follows, for the "jdbc url" use jdbc:sapdb://[yourserver]/[yourdb]
- for the "driver name", use
- use anything for the driver name

Hope that's helpful to others.

I've also added some follow-up notes on the SAP DB installation that will be helpful for many, I'm sure.