Page 1 of 1

Connect to a .mdb database

Posted: Sat Jul 12, 2014 10:08 am
by francof
Hi all, here I am again with a a couple of questions.

I'm using a ODBC connection to a access db (.mdb).
this solution (the odbc conn) is it the only way to do the connection? or there are other ways to avoid the use of odbc data source?
the problem is that if installing my app on other computer, without create the odbc data source, the connection fails, of course.

if the ODBC connection it's the only way, there is the possibility to do it by code into a script?
I found this piece of code

Code: Select all

## ODBC Example
-- Note: When calling dbconn_createObject you pass in 3 parameters
--                The 2nd is "odbc" and the 3rd is the type of database you are
--                connection too
-- dbconn_createObject "development", "odbc", "sql server"
dbconn_set "dsn", "sqlserver_odbc"
dbconn_set "username", "odbc_user"
dbconn_set "password", empty
at this link
http://revolution.screenstepslive.com/s ... ion-object

but it's non very clear for me.... I miss something

franco

Re: Connect to a .mdb database

Posted: Tue Jul 15, 2014 1:13 pm
by AxWald
Hi,

as I understand this example is for SQL Yoga, and you'd need to have this installed ...
"dbconn" isn't in my LC dictionary ...

As I understand, again, ODBC requires certain drivers to be installed, and proper DSN's configured (matching the special driver version ...). There's code examples out there, but they read rather frightening. I refuse to try it, and I ain't faint by heart when it comes to databases ...

May I make a suggestion?
As long as your users interact with local data via an LC app, why use a .mdb at all? Why not using SQLite? It's a lot smaller, faster, and, at least to my experience, very reliable.

I'd never use Access as an actual database engine. It's not really useful for it. Access shines when it comes to write sophisticated front-ends, and with its ability to easily connect to whatever "real db engine". My .mdb's usually have a bunch of linked tables in it, heaps of queries and reports, and lots and lots of VBA code. But only a few local tables, for preferences and temp data. My precious data always reside in a real database, outside of Access.

Why not re-create your tables in SQLite (maybe with SQLite Manager), link to Access and fill it with data from there?

And then forget all about those troubles. The DB will be small and lightening fast, will run in any environment, you only need to calculate the proper path at runtime, for the revOpenDatabase call.

Wouldn't this be much more easy? And you still could use an Access front end to manipulate the data ;-)

Have a good time!

Re: Connect to a .mdb database

Posted: Tue Jul 15, 2014 5:05 pm
by francof
ciao AxWald,
thanks for your reply
AxWald wrote: ....
May I make a suggestion?
As long as your users interact with local data via an LC app, why use a .mdb at all? Why not using SQLite? It's a lot smaller, faster, and, at least to my experience, very reliable.
....
I already tried to use SQLite importing data from mdb using the program SQLiteConverter.
AxWald wrote: ....
Why not re-create your tables in SQLite (maybe with SQLite Manager), link to Access and fill it with data from there?
....
is it so easy?
in sqlite-manager (the add-on of Firefox) I only saw the option for import data from a CSV file, and this step returned me incorrect data... surely I did something wrong.
I have very little experience but, in converting of data, using SQLiteConverter, from the mdb I had some small loss of data, datatype MEMO.
Finally, I discovered that isn't possible protect with password a SQLite db (I may be wrong) :oops:
AxWald wrote: ....
And then forget all about those troubles. The DB will be small and lightening fast, will run in any environment, you only need to calculate the proper path at runtime, for the revOpenDatabase call.
....
you're right, only problems. surely I will change it. much more, my app will be deployed for mobile..... I have to laugh :lol:

regards
franco