Using a File DSN EDITED 02/12/2008 14:42
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Using a File DSN EDITED 02/12/2008 14:42
Is it possible to connect to an Access db using a file dsn?
I've done this before with other development software but cannot see how to acheive in Revolution.
File DSN example below.
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=admin
UserCommitSync=no
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
DriverId=25
DefaultDir=C:\mydb\
DBQ=C:\mydb\mydb.mdb
I've done this before with other development software but cannot see how to acheive in Revolution.
File DSN example below.
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=admin
UserCommitSync=no
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
DriverId=25
DefaultDir=C:\mydb\
DBQ=C:\mydb\mydb.mdb
Last edited by AndyP on Tue Dec 02, 2008 3:44 pm, edited 4 times in total.
In theory:
Note the empty item between theDSNfile and username.
Code: Select all
get revOpenDatabase("odbc","theDSNfile",,"admin","adminpassword","cursortype")
Rev dictionary wrote:To use a DSN to identify an ODBC database, use the DSN as the host, and leave the databaseName parameter empty.
-
- VIP Livecode Opensource Backer
- Posts: 1236
- Joined: Sat Apr 08, 2006 1:10 pm
- Location: Zurich
- Contact:
I don't know much about databases, and nothing about dsn files. Said that, if you need to give rev the data within the file, maybe you should load it into memory first, then give that to the revOpenDatabase function:
Code: Select all
put url "file:path/to/dsnfile" into theDSN
get revOpenDatabase("odbc",theDSN,,"admin","adminpassword","cursortype")
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Hmmm, well I said "in theory"
And in theory, using the path to the DSN file should be correct - I don't think you have to load the contents.
I did some testing and I cannot make a File DSN work. I get an error:
[Microsoft][ODBC Driver Manager]Invalid string or buffer length
If I change the File DSN to a System DSN and just use the name of the System DSN, then I get a connection OK.
(You might have to work to stop it barfing on paths and/or table names with spaces in)
And in theory, using the path to the DSN file should be correct - I don't think you have to load the contents.
I did some testing and I cannot make a File DSN work. I get an error:
[Microsoft][ODBC Driver Manager]Invalid string or buffer length
If I change the File DSN to a System DSN and just use the name of the System DSN, then I get a connection OK.
(You might have to work to stop it barfing on paths and/or table names with spaces in)
Thanks SparkOut, BVG,
I will have a play with the paths etc and if I find a usable solution post it back here for reference.
I will have a play with the paths etc and if I find a usable solution post it back here for reference.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
EDITED 02/12/2008 14:42
OK, I think I've exhausted all permatations and have come to the conclusion that FileDSN will not work with the ODBC Revolution dll (dbodbc.dll)
It's a shame because using a FileDSN is an easy way to add connectivity to an Access db, you need to just deploy the FileDSN file with the application.
Anyway moving on, what I've decided to do is to create a System DSN on the clients computer using writes to the registry. I'm going to post an article and example on how to do this later today in the 'Databases' section of the forums.
Posting is here:
EDITED 02/12/2008 14:42
http://forums.runrev.com/phpBB2/viewtopic.php?t=2441
It's a shame because using a FileDSN is an easy way to add connectivity to an Access db, you need to just deploy the FileDSN file with the application.
Anyway moving on, what I've decided to do is to create a System DSN on the clients computer using writes to the registry. I'm going to post an article and example on how to do this later today in the 'Databases' section of the forums.
Posting is here:
EDITED 02/12/2008 14:42
http://forums.runrev.com/phpBB2/viewtopic.php?t=2441
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
Hi mwieder
No I haven't, will do now.
No I haven't, will do now.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search