190 likes | 282 Views
64-bit Cold Fusion 9 and MS Access: problems and possible solutions. Simon Kingston Russ DenBleyker. Agenda. Introduce Main Problem and Solution Introduce Secondary Problem and Solution Tips on using ColdFusion with SQL Server. The Main Problem.
E N D
64-bit Cold Fusion 9 and MS Access: problems and possible solutions Simon Kingston Russ DenBleyker
Agenda Introduce Main Problem and Solution Introduce Secondary Problem and Solution Tips on using ColdFusion with SQL Server
The Main Problem Sometime this year, I&M Websites are moving to 64-bit servers running 64-bit ColdFusion 9 (CF9) 64-bit CF9 doesn’t natively support MS Access as a data source Therefore, I&M websites that are currently running CF with MS Access data sources will need to be updated to use a supported data source
What Databases are Supported by 64-bit CF 9? DB2 MySQL Oracle Informix PostgreSQL SQL Server Sybase
Proposed Solution to 64-bit CF9 Data Source Problem Deliver MS Access databases to NRPC Convert MS Access Databases to SQL Server Create a new CF9 Data Source using the SQL Server database Update CF to work with SQL Server data source
Updates to Database • Data • Submit replacement MS Access database OR • Update data in SQL Server database (on DEV environment) • Schema • Submit replacement MS Access database OR • Update schema in SQL Server database (on DEV environment)
The Other Problem The current CF app. publication model is as follows Create MS Access (or other) CF Data Source locally Build CF app. locally using the Data Source Send in database to NRSS Ft. Collins IT Team Wait for IT team to create CF Data Source Post CF code to production server
Proposed Solution to the Other Problem Post CF code to DEV server and get CF working Move CF code to TEST server and do QA checks, corrections Submit Help Desk ticket to get CF code published to Production
Setting Up a Local CF Dev.vs. Using the WASO CF Dev. Server • Advantages of using local development server • You can view CF server logs and you can specify 127.0.0.1 for a debugging output IP address – this makes debugging much easier • You can upgrade to a new version any time you want • The server is always available • Advantages to using WASO server • You don’t have to do a Cold Fusion Developer installation • You don’t have to install SQL Server on your computer
Setting Up a Local Dev. Environment Install Cold Fusion Development Server – downloaded for free from Adobe Install SQL Server (note that WASO is using SQL 2008, NOT SQL 2008 R2) Open SQL Server Network Configuration and verify that the TCP/IP service is enabled. Application databases can be developed in Access and then converted to SQL Server using the upsizing wizard. Create new SQL Server Cold Fusion data sources Convert Cold Fusion web pages from Access SQL to Transact-SQL (T-SQL) Move application to WASO server
Using the WASO Dev. Server Clean up database by removing unnecessary tables and queries, removing linked tables, and cleaning up indexes Submit Access database for upsizing to WASO SQL Server Copy pages to WASO development server Convert Cold Fusion web pages from Access SQL to T-SQL
Converting Access SQL to T-SQL Part 1: Upsizing Wizard data type conversion
Converting Access SQL to T-SQL Part 2: Functions and Null Concatenation • There is no Trim() function in T-SQL • Access: Trim(Fieldname) • T-SQL: LTrim(RTrim(Fieldname)) • Concatenation involving nulls • Access: Using “&”, concatenating null doesn’t yield null. Using “+”, concatenating null yields null • T-SQL: Everything is concatenated using “+”, the result depends on your database options
Converting Access SQL to T-SQL Part 3: Getting Date and Time • Date • Access: SELECT Date() • TSQL: Convert(smalldatetime, getdate()) • Date and Time • Access: SELECT Now() • T-SQL: SELECT Getdate()
Converting Access SQL to T-SQL Part 4: Referring to Date Literals • Date Literals • Access: WHERE VisitDate = #1/1/2011# • T-SQL: WHERE VisitDate = ‘1/1/2011’ • Dates Using Cold Fusion Variables • Access: BETWEEN ###StartDate### AND ###EndDate### • T-SQL: Between #’StartDate’# AND #’EndDate’#
Converting Access SQL to T-SQL Part 5: Formatting Dates • Format() Function Not Valid in T-SQL • Access: SELECT Format(VisitDate, “yyyy/mm”) • T-SQL: CAST(Year(VisitDate) AS Varchar(4)) + ‘/’ + CAST(Month(VisitDate)AS Varchar(2)) • Note that the string concatenation operator in T-SQL is ‘+’ and in T-SQL all pieces of a concatenation string must be converted to character and that T-SQL uses single rather than double quotes around literals. • Use Replicate to insert leading zeros • Access: Format([VisitDate],'yyyy/mm‘) • T_SQL: Cast(Year(VisitDate) AS varchar(4)) + '/' + replicate('0',2-len(MONTH(VisitDate)))