ODBC "file DSN" work yet?

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

ODBC "file DSN" work yet?

Post by stephenmcnutt » Mon Oct 15, 2012 6:22 pm

I'm using an ODBC connection to a Microsoft Access database. Using the ODBC Data Source Administrator [In Windows 7: Control Panels --> Administrative Tools --> Data Sources (ODBC)], I can create connections using either a "User DSN" or a "System DSN", and either will work with my LiveCode app. It seems, though, that the third option, "File DSN", is a better solution for deploying an app because the other two options don't work after the app is moved to another computer.

This post (http://forums.runrev.com/phpBB2/viewtopic.php?t=2382) suggests "File DSN" is supposed to work with LiveCode but didn't at the time of the post (2008). Has it been fixed yet?

There's another solution (http://forums.runrev.com/phpBB2/viewtopic.php?t=2441), and while I applaud the contributor, AndyP, for getting the job done, his solution, which involves editing the registry, is hideously unelegant given the existence of the "File DSN" method that's specifically designed to address this portability issue and would probably involve a whopping 1 line of code. Plus I believe AndyP's solution won't work unless the computer has administrative rights, which it won't in my deployment scenario.

So... What about this "File DSN" thing?

What I think I know: It's a portable file (as opposed to a registry entry, which is what "User DSNs" and "System DSNs" are), which you create using the ODBC Data Source Administrator. You then stick this file inside your application somewhere, and it provides the info needed to make the ODBC connection.

The problem is that no one seems to know how to tell LiveCode about the file. LiveCode knows how to find "User DSN" and "System DSN" information. We just have to figure out how to tell it: "Hey, look at this file when perusing the available ODBC data sources."

Codedependent
Posts: 1
Joined: Thu Mar 28, 2013 10:01 am

Re: ODBC "file DSN" work yet?

Post by Codedependent » Wed Sep 18, 2013 9:07 am

Stephen, did you ever work this out?

Can anyone else answer this?

I'm completely new at LiveCode (haven't written a line yet, but I used to program a lot back in the gwbasic, qbasic and QuickBasic 4.5 days) and I want to write a program that needs to read (no write at all) an access 2.0 database (that may be in various locations in other businesses, and I don't have the option to upgrade the database because it's used by another software package I have no control over), but I won't have access to people's machines to create the system or user DSN. If this file DSN works, I can make a routine edit it and point it at the database on that machine.

If LiveCode still can't use file DSNs... I think I could programmatically create an ODBC connection in VB according to an article on MSDN (I can't post the link properly... not enough permission: msdn.microsoft.c o m/en-us/library/aa984313(v=vs.71).aspx) - could I open the connection in VB and then do the reading in LiveCode?

Thanks in advance,
CD

Post Reply