How to use the Microsoft JDBC Driver for SQL Server in ColdFusion

I recently had an issue where the datasources using the Microsoft SQL Server Driver in ColdFusion were failing. The error was:

java.sql.SQLException: Timed out trying to establish connection

There was no change with the database server. For some reason the driver was just not connecting. This led to an exploration of connecting using JDBC both with the Adobe jar included with ColdFusion and by downloading the Microsoft JDBC Driver for SQL Server.

Using the Microsoft JDBC Driver for SQL Server

First you must obtain the driver and make it available to ColdFusion:

To create a JDBC data source to connect to an MS SQL Server database in ColdFusion:

  • Login to CFADMIN
  • Navigate to the Data & Services tab in CFADMIN
  • Enter a Datasource Name: developmentServerJDBC
  • For Driver choose: Other
  • Click: Add

On the ensuing page enter the additional information (change to your info):

  • CF Data Source Name: developmentServerJDBC
  • JDBC URL: jdbc:sqlserver://developmentServer:databaseName=developmentDatabase;Port=1433;encrypt=false;
  • Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
  • Driver Name: mssql-jdbc
  • User name: developmentUser
  • Password: ************
  • Description (optional): Uses Microsoft jar file

Using ColdFusion’s Microsoft SQL Server Driver

To create a data source to connect to an MS SQL Server database in ColdFusion:

  • Login to CFADMIN
  • Navigate to the Data & Services tab in CFADMIN
  • Enter a Datasource Name: developmentServer
  • For Driver choose: Microsoft SQL Server
  • Click: Add

On the ensuing page enter the additional information (change to your info):

  • CF Data Source Name: developmentServer
  • Database: developmentDatabase
  • Server: developmentServer
  • Port 1433
  • User name: developmentUser
  • Password: ************
  • Description (optional): Uses ColdFusion's Microsoft SQL Server Driver

BONUS: Using ColdFusion’s Microsoft SQL Server Driver with JDBC

To create a JDBC data source to connect to an MS SQL Server database in ColdFusion:

  • Login to CFADMIN
  • Navigate to the Data & Services tab in CFADMIN
  • Enter a Datasource Name: developmentServerMicrosoftJDBC
  • For Driver choose: Other
  • Click: Add

On the ensuing page enter the additional information (change to your info):

  • CF Data Source Name: developmentServerMicrosoftJDBC
  • JDBC URL: jdbc:sqlserver://developmentServer:databaseName=developmentDatabase;Port=1433;encrypt=false;
  • Driver Class: macromedia.jdbc.MacromediaDriver
  • Driver Name: macromedia-jdbc
  • User name: developmentUser
  • Password: ************
  • Description (optional): Uses Adobe jar file

ACF Bug CF-4219847 (GENERATEDKEY and IDENTITYCOL are not returned)

ACF Bug CF-4219847 (GENERATEDKEY and IDENTITYCOL are not returned when performing an insert using MSSQL Symmetric Keys)

Filed as ACF bug CF-4219847.

This is not a bug in Lucee and functions as expected.

This demo illustrates that GENERATEDKEY and IDENTITYCOL are not returned when performing an insert using MSSQL Symmetric Keys.

ColdFusion 2023

ColdFusion 2023 IDENTITYCOL CF-4219847
ColdFusion 2023 IDENTITYCOL CF-4219847

ColdFusion 2021

ColdFusion 2021 IDENTITYCOL CF-4219847
ColdFusion 2021 IDENTITYCOL CF-4219847

Lucee 6

Lucee 6 IDENTITYCOL CF-4219847
Lucee 6 IDENTITYCOL CF-4219847

Code to Reproduce:

ACF Bug CF-4219348 (cfdirectory Filter: The importance of filter order)

UPDATE

This bug has been FIXED by Adobe in Build No: 2023.0.0.330651!


Filed as ACF bug CF-4219348.

This is not a bug in Lucee and functions as expected.

This demo illustrates the importance of filter order for cfdirectory in ACF.

A directory contains the following files:

  • this-is-a-doc.doc
  • this-is-a-docm.docm
  • this-is-a-docx.docx
  • this-is-a-xls.xls
  • this-is-a-xlsm.xlsm
  • this-is-a-xlsx.xlsx

The filter attribute of cfdirectory accepts a pipe delimited list. When a 3 digit file extension precedes a 4 digit file extension in the filter attribute of cfdirectory (and the extensions share the same first 3 characters) only files with the 3 digit extension are included. You could use an astericks () on the front and the back of the extension (.doc*) to retrieve both .doc and .docx, but this could also include additional files you don’t want to retrieve such as .docm files. The same is true for .xls, .xlsx, and .xlsm files.

Option 1: Filter (.doc|.docx|.xls|.xlsx): Returns 2 files: this-is-a-doc.doc, this-is-a-xls.xls

directory-filter-ACF-option-1

Option 2: Filter (.docx|.doc|.xlsx|.xls): Returns 4 files: this-is-a-doc.doc, this-is-a-docx.docx, this-is-a-xls.xls, this-is-a-xlsx.xlsx

directory-filter-ACF-option-2

Option 3: Filter(.doc|.xls): Returns 6 files: this-is-a-doc.doc, this-is-a-docm.docm, this-is-a-docx.docx, this-is-a-xls.xls, this-is-a-xlsm.xlsm, this-is-a-xlsx.xlsx

directory-filter-ACF-option-3

Code to Reproduce:

Mac Diff/Merge Utility for Dreamweaver

If you have done web development on a PC in Dreamweaver you have probably used WinMerge to check for differences between local and remote files.  Since I moved to the Mac a few years ago I have been neglectful in finding a similar tool for the Mac.  Thanks to some changes in my current day job I now have a larger team and more of a need for getting my act together on this.

The tool I have decided on in a free one called DiffMerge.  Part 1 of the install is the typical Mac install (drag a file to the Applications folder).  Part 2 is a little more detailed (but dead simple).  There is a readme.txt file in the installer image with instructions for copying 2 files to facilitate command line usage (You will need this for Dreamweaver).

Once you have done the installation and followed the readme.txt fire up Dreamweaver and click Dreamweaver > Preferences > File compare and set the path to your equivalent of the screenshot below:

DiffMerge for Dreamweaver on the Mac

Save, Format, View Dreamweaver Checked Out By Report

I wrote a post a while back about a file I created to format Dreamweaver search results for printing. Recently the need arose for me to apply that same formatting to Dreamweaver’s “Checked Out By” report.

Here is what your report will look like:

Checked Out By Report View

Download the search_results.zip file here. It contains the files to transform both “Search Results” and the “Checked Out By” report.

*** UPDATED 2/27/2015 ***

As a security measure Chrome blocks access to local files. You must open Chrome from the command line with a flag to allow access to local files.

Follow these steps to allow local file access in Chrome on the Mac:

  • If you have Chrome open, close it
  • Open a terminal window
  • Execute the command:
    open /Applications/Google Chrome.app --args --allow-file-access-from-files
  • Once Chrome opens select ‘File > Open File’ and browse to your local xml file
  • Voilà

Best Firefox Add-ons for web developers?

I’m looking for the best Firefox Add-ons for web developers.

A few things you should know about me:

  1. I like lists.  A lot.  I make them all the time for everything.
  2. I hate repetition and drudgery in my work.  If there is a (legitimate) shortcut I want to know about it.
  3. I’m a ColdFusion web developer who dabbles in jQuery.
  4. I dig Firefox for helping me with all of the above.

Now this is where you come in… What are your favorite/most useful Firefox Ad-ins that help you get your work done on a daily basis?

Here are mine (alpha order):

  • ColorZilla – Eyedropper/colorpicker
  • Dummy Lipsum – Generate “Lorem Ipsum” dummy text.
  • Evernote Web Clipper – For selecting text to evernote
  • Fast Dial – Visual bookmark homepage
  • Firebug – My main usage is debugging AJAX
  • FIreGestures – Executes commands with mouse gestures
  • FireShot – Screen shot utility
  • iMacros – Awesome utility for building test cases or automating repetitious tasks
  • TinyURL Generator – Generates TinyURLs
  • Web Developer – Adds tons of tools (too numerous to list)
  • Xmarks – Sync your bookmarks across multiple machines (and platforms!)

Thanks, I look forward to hearing from you.

I’m an ACE (Adobe Certified Expert) in Advanced ColdFusion 8

Two months of studying paid off today.  I took my ACE exam for ColdFusion 8 and passed with a 98%, which also means I qualified for the Advanced status.  The Web Application Construction Kit is all you’ll ever need to become a CF Ninja.  For the exam I’d recommend reading the first volume cover to cover. Additionally I found the ColdFusion MX 7 Certified Developer Study Guide to be very useful.  Even if you don’t need it for your job challenge yourself and go for it.

ColdFusion 8 WACK ColdFusion MX 7 Certified Developer Study Guide

Hide .lck files (and others) in Aptana on the Mac

I’m test driving the Aptana Studio plugin for eclipse.¬† It looks very slick.¬† Just a quick “how to” note for hiding files (like Dreamweaver .lck files, hidden system files, etc) in the project window.

  • Click the Project Window Tab
  • Hit FN+CMD+F10
  • Select “Filters…” in the dialog that opens
  • Check the boxes beside all the types you want to hide
  • Click ‘Ok’

Pretty simple.¬† So why did it take me an hour to figure it out 😐

Via Con Dios, Geocities

Yahoo has officially pulled the plug on Geocities.

http://www.sitepoint.com/blogs/2009/05/03/rip-geocities/

I learned HTML making my Geocities site. I would love to see that brilliant collection of animated gifs and snazzy javascripts, but alas, I cannot find it anywhere in my archives. Even though the site I had there was terrible, I did learn some of the very basics constructing it.

Although I had long forgotten Geocities I definitely felt a little nostalgic when I learned of its demise.  Via Con Dios, Geocities.

Anyone else a little misty eyed?

Adobe CS4 Download File Too Large For USB Sandisk Cruzer

Adobe CS4 Download File Too Large For USB Sandisk Cruzer

Part I
I finally took the plunge and bought the upgrade to CS4 yesterday from Adobe.¬† Downloading the gi-normous 4.8 GB file was like watching my cat try to eat a chijuajua.¬† Painful.¬† I guess I could have downloaded all the trials and entered the license code, but it just feels more “official” to download the single file.¬† At $599 I need “official”.¬† Update: I moved my downloading operation to my work computer since it was dying at home.¬† Once I finally got the file downloaded though I encountered a second problem.


Part II
I have a Sandisk Cruzer (8 GB).¬† However, after trying to put the 4.8 GB file on it 10 times and getting “The disk in the destination drive is full, please insert a new disk to continue” each time I finally did some googling and realized that the problem was that by default the Cruzer is formated to FAT32 and the maximum file size for FAT32 is 4GB.¬† Here is how to reformat to NTFS.