{"id":508,"date":"2014-10-14T09:37:40","date_gmt":"2014-10-14T13:37:40","guid":{"rendered":"http:\/\/www.cfchimp.com\/wordpress\/?p=508"},"modified":"2024-12-05T20:10:57","modified_gmt":"2024-12-06T01:10:57","slug":"connecting-coldfusion-10-to-foxpro-9","status":"publish","type":"post","link":"https:\/\/csimmons.dev\/blog\/2014\/10\/connecting-coldfusion-10-to-foxpro-9\/","title":{"rendered":"Connecting ColdFusion 10 to FoxPro 9"},"content":{"rendered":"<p>My company has a legacy application built in FoxPro 9 which contains a table that I need to extract data from on a recurring basis. I have never worked with FoxPro. Apparently in FoxPro each table has a corresponding .dbf file. For this example we will say that the table file is <code>persons.dbf<\/code>, which resides at <code>C:\\legacyapp\\data\\<\/code>.<\/p>\n<p>The first step for connecting ColdFusion to the FoxPro database was to find an acceptable driver. I initially tried to use some ODBC drivers but abandoned this route. Not only was it just not working, but I do my development on a Mac (whereas production is Windows) and I really wanted a solution that did not involve a Windows and a Mac configuration.<\/p>\n<p>So the following steps describe how I set up a jdbc connection to FoxPro 9 from ColdFusion.<\/p>\n<ol>\n<li>Download the <a href=\"http:\/\/www.csv-jdbc.com\/stels_dbf_h2\/doc.htm\">StelsDBF JDBC Driver<\/a><\/li>\n<li>Place the dbfdriver.jar file in <code>{ColdFusion-Home}\/cfusion\/lib<\/code> aka <code>C:\\ColdFusion10\\cfusion\\lib\\<\/code><\/li>\n<li>Restart the ColdFusion services<\/li>\n<li>Login to the CFADMIN and set up a Data Source\n<ul>\n<li>For &#8216;Data Source Name&#8217; enter &#8216;legacyapp&#8217;<\/li>\n<li>For &#8216;Driver&#8217; select &#8216;Other&#8217;<\/li>\n<li>Click &#8216;Add&#8217;<\/li>\n<li>For JDBC URL enter &#8216;jdbc:jstels:dbf:c:\/legacyapp\/data&#8217;<\/li>\n<li>For Driver Class enter &#8216;jstels.jdbc.dbf.DBFDriver2&#8217;<\/li>\n<li>Click &#8216;Submit&#8217;<\/li>\n<\/ul>\n<\/li>\n<li>When using cfquery to select data use the file name as the table name:\n<pre class=\"prettyprint\">SELECT \r\n    LASTNAME, FIRSTNAME\r\nFROM\r\n    persons\r\n<\/pre>\n<\/li>\n<\/ol>\n<p>It was actually not too bad to set up once I located the driver.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My company has a legacy application built in FoxPro 9 which contains a table that I need to extract data from on a recurring basis. I have never worked with FoxPro. Apparently in FoxPro each table has a corresponding .dbf file. For this example we will say that the table file is persons.dbf, which resides &#8230; <a title=\"Connecting ColdFusion 10 to FoxPro 9\" class=\"read-more\" href=\"https:\/\/csimmons.dev\/blog\/2014\/10\/connecting-coldfusion-10-to-foxpro-9\/\" aria-label=\"Read more about Connecting ColdFusion 10 to FoxPro 9\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_cloudinary_featured_overwrite":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[68],"tags":[48,12],"class_list":["post-508","post","type-post","status-publish","format-standard","hentry","category-developer","tag-coldfusion","tag-developer"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbVg43-8c","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/comments?post=508"}],"version-history":[{"count":0,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/508\/revisions"}],"wp:attachment":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/media?parent=508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/categories?post=508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/tags?post=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}