Autore Topic: Accedere a file MDB  (Letto 802 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.266
  • Ne mors quidem nos iunget
    • Mostra profilo
Accedere a file MDB
« il: 27 Agosto 2013, 14:04:31 »
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:

Codice: gambas [Seleziona]
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
"
« Ultima modifica: 27 Agosto 2013, 14:09:41 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.266
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Accedere a file MDB
« Risposta #1 il: 29 Agosto 2013, 20:07:06 »
...continua...


" It's perhaps a little off-topic as this is a Gambas mailing list, but I
have written a .mdb to mysql|postgresql|hsqldb|mssqlserver converter in
java.  I tried using mdbtools but never got very satisfactory results,
so I wrote my own conversion software.

The converter works on Northwind (the sample .mdb from MS), including
the binary pictures and on our own database we use for stock control at
work (150,000 records or so, takes about 5 mins...).  There is support
for complete conversion of the schema (create all tables, columns with
null/not null, create primary keys, indexes, foreign key relations, ...)
and of course, the all-important data!

I'm looking to test against a few more databases, so if this is an
interesting route to follow, don't hesitate to contact me directly.

I also support a kind of basic "interactive mode" through a socket where
you can retrieve rows, do simple selects, examine columns etc.  The
conversion is done using only commands which are also available as
interactive commands...

Kind regards,
Caveat
"


" Are you accessing directly the mdb file structures or using intermediary
software, e.g. ODBC?

Regards,
Fernando
"


" is your converter free ? (GPL ?)

Fabien Bodard
"


" The software directly accesses the mdb file, using the jackcess library
(http://jackcess.sourceforge.net/), so no Access nor Windoze required.

I haven't worked out all the licensing yet (it builds on a few other
java libraries too) so I'm not yet ready to release the code publicly.

What I'm looking for is to try the software out on a few other
databases, see what makes it break

Right now there's no guarantees it doesn't just happen to work on
Northwind and our database from work by pure chance

Kind regards,
Caveat
"
« Ultima modifica: 31 Agosto 2013, 12:29:21 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.266
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Accedere a file MDB
« Risposta #2 il: 04 Gennaio 2014, 20:15:48 »
Aggiungerei anche questa discussione apparsa nel forum del comunità ispanica dei programmatori Gambas:

http://www.gambas-es.org/viewtopic.php?f=3&t=3537
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »