Wiring Up A 32 Bit ODBC DSN With 64 Bit CF 9

Posted By : todd sharp Posted At : April 7, 2011 8:06 PM Posted In: ColdFusion

16

Quite a long title, but there's simply no easy way to simply describe what I'm about to cover in this post. To give a bit of back story - the project I'm getting started on requires that I hook CF to a FoxPro Database. This comes with all kinds of headaches as there is no (free) JDBC drivers out in the wild that I could find so I had to go the good ole ODBC Socket route.

The first step was to get a hold of the proper drivers for FoxPro. At the time of this blog post I found them here - who knows who long that link will stay alive in Microsoft land - but I digress. The trick here, as you'd soon find if you scamper off to create a new ODBC DSN on 64 bit Windows is that you'll have to use the 32 bit ODBC Admin interface. I found mine in the following location:

C:\Windows\SysWOW64\odbcad32.exe

Within the 32 bit ODBC Admin you can create a new DSN and point it at the appropriate FoxPro DB. The next step is to head to the CF administrator and wire up a CF DSN to the ODBC DSN. Create a new datasource and select 'ODBC Socket' as the type. On the following screen you may notice that the ODBC DSN you just created in Windows is not shown in the drop down. Here's where it gets a bit dirty. Inspect the <select> element in your favorite console (I used Chrome dev tools) and add the dsn as an option yourself making sure to use the same name from the Windows admin (add it as both the value and the text for the option). Now enter your username and password and save. Your datasource should verify and you're free to use it from <cfquery> as you would any other CF DSN.

Yeah, it's dirty and cheap and it might have some ugly consequences, but it works and is the only way I could find to hook up a 64 bit install of CF to a FoxPro DB. Feel free to comment if you know of a better way.

Side Note: Lest anyone think I have anything against paid software I should mention that this particular project is for the church where my brother is a pastor so the funds are limited and a $500 driver was a bit out of budget for the particular project.

Comments (16)

Scott P's Gravatar yep - exactly how I had to do it on 8 couple of years ago. subscribing to see if a better solution shows up.

Andy K's Gravatar Out of curiosity, which version of FB are you using? We are using a multi-user Foxbase 2.10 (yes... DOS!) app and have been trying to add functionality via CF and I am struggling with what is safe/unsafe as far as reading/writing to these flat files while the app is being simultaneously used by many other users.

Right now all functionality is of a read only nature and is only accessing copies of the files that we update/refresh after hours, so it's not realtime.

todd sharp's Gravatar @Andy K:

I'm not sure what version it is really. I haven't gone much further then wiring it up and testing that a simple select worked as expected. The data I'm working with will be completely read only (no writes/deletes) so I'm not sure what to tell you. From what I've read FoxPro does not support transactions so read/writes are blocking.

Scott P's Gravatar Mine is pretty much readonly also - we use it to pull in data to an sql database nightly. We'll very rarely access it live and even it is even rarer we'll write to it.

Chad's Gravatar I was able to do this with Win2003 server a year of so ago. When I tried to create an ODBC with Win2008 server today I got:

Error accessing available odbc datasources. - Cannot open HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INIODBC Data Sources: Windows error 2 occurred.The system cannot find the file specified.

Any ideas?

Chad's Gravatar Figured out that I needed to make a 64bit DSN to initialize something on the server. I used firebug to manually enter my 32bit DSN, submit and get:

Connection verification failed for data source: merlinFoxPro
java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket]internal error: The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
The root cause was that: java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket]internal error: The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).

Any ideas? Thanks

Seth's Gravatar I had to create a 32 bit datasource for eRets
to download real estate listings. This worked like a charm on Windows 2008 R2 with ColdFusion 9.
Thanks Todd!

Beats By Dre Online Store's Gravatar Nice post.Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks.

sooojerseys's Gravatar http://www.ravensfansjerseys.com Baltimore Ravens Jerseys
http://www.cardinalsfansshop.com Darnell Dockett Jerseys
http://www.jetsfansshop.com New York Jerseys

sale cheap beats's Gravatar 2011 released monster headphones

newest monster beats headphones

lady gaga headphones

tods shoes's Gravatar I beats by dr dre,beats by dr dre believe that we are not real social workers.

spaccio hogan's Gravatar hogan does not just end with athletic and outerwear sneakers. For those who need to have a great substantial fashion sandal or heel, you may also obtain options on this department from your designer!

alexander mcqueen outlet's Gravatar alexander mcqueen outletalexander mcqueen outletalexander mcqueen outlet

Packers Jersey's Gravatar People, o my what a wonderful site you have here.