Anything available that can read Microsoft .MDB files from Python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Nagle

    #1

    Anything available that can read Microsoft .MDB files from Python?

    I'm looking for something that can read .MDB files, the format
    Microsoft Access uses, from Python. I need to do this on
    Linux, without using Microsoft tools. I just need to read
    the files once, so I can load the tables into another database.
    Speed isn't an issue, and I don't need to access the file in
    database fashion. The files are too big to read into RAM all at once,
    though.

    I tried "MDBtools", but the only (last) release was
    a pre-release three years ago, and I've encountered
    many build problems trying to make it work on Fedora
    Core 6.

    John Nagle
  • Diez B. Roggisch

    #2
    Re: Anything available that can read Microsoft .MDB files from Python?

    John Nagle schrieb:
    I'm looking for something that can read .MDB files, the format
    Microsoft Access uses, from Python. I need to do this on
    Linux, without using Microsoft tools. I just need to read
    the files once, so I can load the tables into another database.
    Speed isn't an issue, and I don't need to access the file in
    database fashion. The files are too big to read into RAM all at once,
    though.
    >
    I tried "MDBtools", but the only (last) release was
    a pre-release three years ago, and I've encountered
    many build problems trying to make it work on Fedora
    Core 6.
    I was just gonna suggest it. Under ubuntu, it works easy as cake, and
    converts the mdb nicely to some CSV-files.

    I think you should really try and make it work.

    Diez

    Comment

    • John Nagle

      #3
      Re: Anything available that can read Microsoft .MDB files from Python?

      Diez B. Roggisch wrote:
      John Nagle schrieb:
      >
      > I'm looking for something that can read .MDB files, the format
      >Microsoft Access uses, from Python. I need to do this on
      >Linux, without using Microsoft tools. I just need to read
      >the files once, so I can load the tables into another database.
      >Speed isn't an issue, and I don't need to access the file in
      >database fashion. The files are too big to read into RAM all at once,
      >though.
      >>
      > I tried "MDBtools", but the only (last) release was
      >a pre-release three years ago, and I've encountered
      >many build problems trying to make it work on Fedora
      >Core 6.
      >
      >
      I was just gonna suggest it. Under ubuntu, it works easy as cake, and
      converts the mdb nicely to some CSV-files.
      >
      I think you should really try and make it work.
      >
      Diez
      What MDBtools did you install? The RPM, a checkout from CVS,
      or the downloadable distribution? They're all different.

      John Nagle

      Comment

      • kyosohma@gmail.com

        #4
        Re: Anything available that can read Microsoft .MDB files from Python?

        On Mar 19, 2:45 pm, John Nagle <n...@animats.c omwrote:
        Diez B. Roggisch wrote:
        John Nagle schrieb:
        >
        I'm looking for something that can read .MDB files, the format
        Microsoft Access uses, from Python. I need to do this on
        Linux, without using Microsoft tools. I just need to read
        the files once, so I can load the tables into another database.
        Speed isn't an issue, and I don't need to access the file in
        database fashion. The files are too big to read into RAM all at once,
        though.
        >
        I tried "MDBtools", but the only (last) release was
        a pre-release three years ago, and I've encountered
        many build problems trying to make it work on Fedora
        Core 6.
        >
        I was just gonna suggest it. Under ubuntu, it works easy as cake, and
        converts the mdb nicely to some CSV-files.
        >
        I think you should really try and make it work.
        >
        Diez
        >
        What MDBtools did you install? The RPM, a checkout from CVS,
        or the downloadable distribution? They're all different.
        >
        John Nagle
        I've read .MDB files using ODBC. I don't know how big your files are,
        but I had a file with almost 3000 rows and I was able to fetch it in
        1-2 seconds. If you want to give it whirl, you just need to create an
        ODBC connection and then do the following:

        myconn = odbc.odbc('mydb _connection_nam e')
        mycursor = myconn.cursor()
        mycursor.execut e('SELECT * FROM db_name')
        mydata = mycursor.fetcha ll()
        mycursor.close( )
        myconn.close()

        for each in mydata:
        # do something like pull the info from the variable "mydata" and
        send it into the other database


        It is fast. But you may like what the others have said more.

        Mike

        Comment

        • Terry Reedy

          #5
          Re: Anything available that can read Microsoft .MDB files from Python?


          <kyosohma@gmail .comwrote in message
          news:1174334517 .125928.274140@ l75g2000hse.goo glegroups.com.. .
          | I've read .MDB files using ODBC. I don't know how big your files are,
          | but I had a file with almost 3000 rows and I was able to fetch it in
          | 1-2 seconds. If you want to give it whirl, you just need to create an
          | ODBC connection and then do the following:

          I'll just mention that OpenOffice.org Base can make ODBC connections and
          output in several formats. Don't know if their ODBC works with .MDB.

          tjr



          Comment

          • Steve Holden

            #6
            Re: Anything available that can read Microsoft .MDB files from Python?

            Terry Reedy wrote:
            <kyosohma@gmail .comwrote in message
            news:1174334517 .125928.274140@ l75g2000hse.goo glegroups.com.. .
            | I've read .MDB files using ODBC. I don't know how big your files are,
            | but I had a file with almost 3000 rows and I was able to fetch it in
            | 1-2 seconds. If you want to give it whirl, you just need to create an
            | ODBC connection and then do the following:
            >
            I'll just mention that OpenOffice.org Base can make ODBC connections and
            output in several formats. Don't know if their ODBC works with .MDB.
            >
            I seem to remember I actually managed to open an MDB file with the Open
            Office database component (but that was on Windows, so I can't guarantee
            it will work on Linux).

            regards
            Steve
            --
            Steve Holden +44 150 684 7255 +1 800 494 3119
            Holden Web LLC/Ltd http://www.holdenweb.com
            Skype: holdenweb http://del.icio.us/steve.holden
            Recent Ramblings http://holdenweb.blogspot.com


            Comment

            • John Nagle

              #7
              Re: Anything available that can read Microsoft .MDB files from Python?

              kyosohma@gmail. com wrote:
              On Mar 19, 2:45 pm, John Nagle <n...@animats.c omwrote:
              >
              >>Diez B. Roggisch wrote:
              >>
              >>>John Nagle schrieb:
              >>
              >>> I'm looking for something that can read .MDB files, the format
              ....
              I've read .MDB files using ODBC. I don't know how big your files are,
              but I had a file with almost 3000 rows and I was able to fetch it in
              1-2 seconds. If you want to give it whirl, you just need to create an
              ODBC connection ....
              But that was on Windows, right? ODBC is just a connection
              mechanism. You have to have a database of the right type to
              which you can connect. On Windows, there's Jet, the engine
              behind Microsoft Access, but what do you connect to on Linux?

              John Nagle

              Comment

              • John Nagle

                #8
                Re: Anything available that can read Microsoft .MDB files from Python?

                Steve Holden wrote:
                Terry Reedy wrote:
                >
                ><kyosohma@gmai l.comwrote in message
                >news:117433451 7.125928.274140 @l75g2000hse.go oglegroups.com. ..
                >| I've read .MDB files using ODBC. I don't know how big your files are,
                >| but I had a file with almost 3000 rows and I was able to fetch it in
                >| 1-2 seconds. If you want to give it whirl, you just need to create an
                >| ODBC connection and then do the following:
                >>
                >I'll just mention that OpenOffice.org Base can make ODBC connections
                >and output in several formats. Don't know if their ODBC works with .MDB.
                >>
                I seem to remember I actually managed to open an MDB file with the Open
                Office database component (but that was on Windows, so I can't guarantee
                it will work on Linux).
                That works fine on Windows, because OpenOffice can use Jet, the Access
                engine. Don't know if it would work on Linux. Probably not.

                I need to read about 10,000,000 records, and running them through an
                OpenOffice spreadsheet probably isn't a good approach. There are quite
                a few tools for dealing with small Microsoft Access databases in memory, but
                they don't scale.

                MDBtools would be the right answer, if it worked. I have some questions
                out on the MDBtools forum, trying to work around some build problems.
                MDBtools hasn't had a release in three years, and it won't build with
                Fedora Core 6.

                John Nagle

                Comment

                • Diez B. Roggisch

                  #9
                  Re: Anything available that can read Microsoft .MDB files from Python?

                  >
                  What MDBtools did you install? The RPM, a checkout from CVS,
                  or the downloadable distribution? They're all different.

                  The one that comes with ubuntu edgy. Just


                  apt-get install mdbtools

                  or something, that's it.

                  I don't want to start a distro war here - but I always found the
                  RPM-based distros lacking, to say the least.

                  Diez

                  Comment

                  • Shane Geiger

                    #10
                    Re: Anything available that can read Microsoft .MDB files from Python?

                    Try installing it from source. Perhaps getting a newer verion is all
                    you would need. If at that point you find there is a bug, report it.


                    Diez B. Roggisch wrote:
                    > What MDBtools did you install? The RPM, a checkout from CVS,
                    >or the downloadable distribution? They're all different.
                    >>
                    >
                    >
                    The one that comes with ubuntu edgy. Just
                    >
                    >
                    apt-get install mdbtools
                    >
                    or something, that's it.
                    >
                    I don't want to start a distro war here - but I always found the
                    RPM-based distros lacking, to say the least.
                    >
                    Diez
                    >
                    --
                    Shane Geiger
                    IT Director
                    National Council on Economic Education
                    sgeiger@ncee.ne t | 402-438-8958 | http://www.ncee.net

                    Leading the Campaign for Economic and Financial Literacy


                    Comment

                    • Duncan Booth

                      #11
                      Re: Anything available that can read Microsoft .MDB files from Python?

                      "Terry Reedy" <tjreedy@udel.e duwrote:
                      >
                      ><kyosohma@gmai l.comwrote in message
                      news:1174334517 .125928.274140@ l75g2000hse.goo glegroups.com.. .
                      >| I've read .MDB files using ODBC. I don't know how big your files are,
                      >| but I had a file with almost 3000 rows and I was able to fetch it in
                      >| 1-2 seconds. If you want to give it whirl, you just need to create an
                      >| ODBC connection and then do the following:
                      >
                      I'll just mention that OpenOffice.org Base can make ODBC connections and
                      output in several formats. Don't know if their ODBC works with .MDB.
                      >
                      I just tried opening an mdb file from Open Office under Ubuntu. No problems
                      whatsoever except that the pulldown for 'Connect to an existing database'
                      listed 'Microsoft Access' twice. (This was a completely standard, never
                      before run, copy of Base.)


                      Comment

                      • John Nagle

                        #12
                        Re: Anything available that can read Microsoft .MDB files from Python?

                        Shane Geiger wrote:
                        Try installing it from source. Perhaps getting a newer verion is all
                        you would need. If at that point you find there is a bug, report it.
                        I did.

                        I finally got MDBtools to build by throwing out all the "configure"
                        stuff and the makefiles, then writing some simple makefiles of my own
                        that just build the command line tools. The supplied build files
                        fail if you don't have bison, flex, autoconf, etc., although the
                        documentation claims otherwise.

                        There are some nice little command line tools in there,
                        fighting to get out from under all the guck. The original
                        author intended, I think, to build this thing up into a full
                        database module for .MDB files. But that was back around 2004
                        and never got done. So MDBtools doesn't have enough stuff
                        to directly interface to MDB databases as databases, but
                        it has too much for a file format converter. It's the extra
                        guck that has portability problems.

                        I posted the makefiles I used to the MDBtools forums on
                        SourceForge.

                        John Nagle

                        Comment

                        Working...