Using an Access Database

BlitzMax Forums/BlitzMax Beginners Area/Using an Access Database

Hi Glenn.

As you know there are several ways to create a DSN.
The Access example I provided uses the FileDSN method, which requires a full path to the .dsn file.

The other method requires the ODBC data source to be configured through the system.
To do this on my win2k box, I go to Control Panel, Administrative Tools, and open Data Sources (ODBC).
On the UserDSN tab, I click Add, choose Microsoft Access Driver, and give it a Data Source Name of GlenDSN.
I then Select the .mdb file, and finish up by hitting OK.

This adds an internal DSN to my installation. I had a look in C:\Program Files\Common Files\ODBC\Data Sources, but that folder is empty on my box, so I guess it puts it somewhere else. (perhaps that is a SystemDSN?)

Anyhoo... changing the Access test prog from:
Local db:TDBConnection = LoadDatabase("ODBC", "maxtest", Null, Null, "brucey", "brucey", CurrentDir() + "/maxtest.dsn")

to
[/code]Local db:TDBConnection = LoadDatabase("ODBC", "maxtest", Null, Null, "brucey", "brucey", "GlenDSN")[/code]
it still works.

Remember, if you specifically want to access a .dsn file, you will need to provide a full path to it.
Otherwise, I believe configuring it through the proper application is the best way.

Of course, I could be talking complete nonsense ;-)
(but my tests on all three platforms have worked best when I've configured things through the appropriate GUIs)

:o)