How to configure CFMX7 MySQL 4/5 connector J

I just wasted literally hours of precious time trying to set up the developer edition of CF MX7 to connect to my MySQL 5.1 server by following the (incorrect) instructions that appear all over the internet, including the Adobe support site.

These are the correct steps:

  1. Download the MySQL connector J verison 3 here
  2. Extract the connector file mysql-connector-java-3.1.10-bin.jar into the <cfroot>/runtime/lib folder NOT the <cfroot>/WEB-INF/runtime/lib folder as described in many other places on the internet.
  3. Restart the CFMX7 server
  4. In the CF administrator create a new datasource of type ‘other’
  5. Enter
    jdbc:mysql://[mysql erver]:[port]/[database]

    into the JDBC URL field

  6. Enter

    into the Driver Class field

  7. Enter MySQL user name and password
  8. Submit the new datasource

That should do the trick.

CFML Upload file checklist

I always forget how to build upload forms in CFML so here’s a little checklist to remind myself (and anyone else who is interested)

  1. use an HTML form with the following attributes:
    • method=”post”
    • enctype=”multipart/form-data”
    •             <cfform action="index.cfm" enctype="multipart/form-data" method="post">
                      <cfinput type="file" name="inputfile">
                      <cfinput type="submit" name="upload" value="Upload file">
  2. Use a <cffile action=”upload”> tag something along the lines of…
            <cffile  action="upload" 
            <cfcatch type="any">There was an error uploading the file</cfcatch>
  3. use the CFFILE scope to access the structure containing all information about the upload. Here is a sample listing:
    attemptedserverfile	bookmark.htm
    clientdirectory	[empty string]
    clientfile		bookmark.htm
    clientfileext		htm
    clientfilename		bookmark
    contentsubtype		html
    contenttype		text
    datelastaccessed	{ts '2009-06-03 08:52:40'}
    fileexisted		NO
    filesize		10599
    filewasappended	NO
    filewasoverwritten	NO
    filewasrenamed		NO
    filewassaved		YES
    oldfilesize		0
    serverdirectory	/home/myAccount/myaccount/WORK/uploadtest
    serverfile		bookmark.htm
    serverfileext		htm
    serverfilename		bookmark
    timecreated		{ts '2009-06-03 08:52:40'}
    timelastmodified	{ts '2009-06-03 08:52:40'}