Riporto questa discussione dalla M.L. internazionale:
" Has anyone been able to access .mdb files? I tried with ODBC but got to
the same stage reported here:
http://gambas.8142.n7.nabble.com/Seg-fault-rev-3903-odbc-db-selecting-td4746.html
i.e., no errors in connection, but no data back from a simple select.
Regards,
Fernando "
" Linux does not have direct support for mdb as far as I am aware.
Under Linux, you would need to either locate a an access driver for odbc or
use something like Jackcess in Java middle-ware to access the db. There are
other possibilities such as running MSSQL on a windows machine and remotely
connecting to the dbms. If it must be local you are best off converting the
db to something like MySQL or Postgress. There are tools for converting
from Access to other dbms' and there are some commercial drivers for *nix
systems. Another possibility is to export your Access db to cvs format and
import it into Open Office, then connect to it via open office.
One solution I have not tried nor have I found any info on is possibly
running Access on WINE and connecting to it. But you might want to look in
to it. Could be a dead end though. The best solutions however are either
run a remote dbms to serve you mdb database or convert it to a *nix
supported dbms.
Morgan "
" There is mdbtools, which includes a primitive odbc driver, that I was
trying to use.
http://mdbtools.sourceforge.net/
Regards,
Fernando "
" I made a small example project that makes a connection to a .mdb
This is how it is possible (I only tested the connection, not reading in
tables or changing any records):
1. Install Mdbtools -> this will install all needed libraries
2. Locate libmdbodbc.so.1 (or libmdbodbc.so.0) -> you need the full path
to it for next step
3. Edit odbc.ini with elevated user rights (located in /Etc)
My odbc.ini for this example looks like this
[DataEnquete]
Description = MS Access ODBC
Driver = /usr/lib/i386-linux-gnu/odbc/libmdbodbc.so.1
Database = /home/willy/Databases/DataEnquete-Transport.mdb
IN LINE with Driver =
Replace with full path to your libodbcmdb.so.1 (or libodbcmdb.so.0)
IN LINE with Database
Replace with full path to the .mdb you want to open
Use [DataEnquete] without [ and ] (so DataEnquete) for .Host in your ODBC connection code
OR replace DataEnquete with MyName in .Host and [DataEnquete] with [MyName] in odbc.ini
Code for connecting looks like this:
Private myMdbConnect As New Connection
Private Sub Connect()
With myMdbConnect
.Type = "odbc"
.Host = "DataEnquete"
.Login = "Admin" ' <- It's necesary for mdb
.Name = "" ' <- In odbc always keep blank
End With
myMdbConnect.Open
End
Attached a Source Archive. (vedi allegato)
To make it work first do the steps mentioned above and adapt all to your
code to the content of your odbc.ini.
Raets "
" perhaps you missed my initial email, that's what I did based on an older
email on this list. The problem is, apparently, not the connection but
the retrieving of data.
Regards,
Fernando "