How to open an .accdb file in Ubuntu?
Asked Answered
F

9

23

The development machine I work on has Ubuntu Jaunty Jackalope as its operating system. I have been presented with data for a project I'm working on in the form of an .accdb file created by Microsoft Access. I do not own a copy of Microsoft Access. I do have Open Office installed and would be willing to install any software package available to my operating system. Is there a way I can open or transform this file so that I can view and edit the data on my computer? Is there another format that the Access database could be saved as that I would be able to open?

Fechter answered 30/11, 2009 at 21:3 Comment(1)
G
17

There are two open source tools available however they only work on MDB format files. Can you ask the supplier of the ACCDB file to give it to you in MDB format?

MDB Tools is a set of open source libraries and utilities to facilitate exporting data from MS Access databases (mdb files) without using the Microsoft DLLs.

Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications. It appears to be much newer than MDB tools, is more active and has write support.

Guillot answered 30/11, 2009 at 21:23 Comment(1)
what if we have ACCDB file and we want to open that in Linux. Is there any other alternative?Hoxsie
A
14

Jackcess now supports everything from Access 97 (read-only), 2000, 2003, 2007, and 2010 (read-write), both .mdb and .accdb files.

Dumping the file can be as easy as

import com.healthmarketscience.jackcess.*;
import java.io.*;
public class AccessExport {
  public static void main(String []args) throws IOException {
    System.out.println(Database.open(new File(args[0])).getTable(args[1]).display());
  }
}

(of course, you need a java compiler, libcommons-logging-java, libcommons-lang-java and you have to pass the .accdb filename as the first and the table name as the second parameter).

-Marcel

Aleda answered 19/11, 2012 at 19:27 Comment(0)
B
9

I just had this same problem on an Ubuntu 14.01 AWS EC2 instance and I was able to accomplish this task (convert .accdb file to CSV on Ubuntu) by using access2csv. I had to install Git, install Java, and install ant, but then was able to convert the .accdb files I had to CSV by typing:

$ java -jar access2csv.jar myfile.accdb

It uses Jackcess so you get the same functionality without having to write your own Java code to accomplish this basic task. Each table is returned as its own CSV file.

You can also access the schema by passing the --schema option:

java -jar access2csv.jar myfile.accdb --schema

Hope this is helpful. It certainly was for me.

Berkshire answered 2/11, 2014 at 21:10 Comment(1)
This works. I dowloaded the acess2csv.jar from github.com/AccelerationNet/access2csv/releases and ran the command you mentioned. I'm on Linux Mint btw.Theressa
M
2

A good format to view and work with on Linux would be CSV.

As the accepted answer suggests MDB Tools does the job. To export all the tables on Linux to CSV format try this command:

mdb-tables -d ',' database.accdb| xargs -L1 -d',' -I{} bash -c 'mdb-export database.accdb "$1" >"$1".csv' -- {}

You can use mdbtools also into windows via WSL (Ubuntu on Windows or Debian on Windows): Then install it in console with:

sudo apt install mdbtools
Melanochroi answered 29/11, 2018 at 10:1 Comment(5)
Nice oneliner but sadly mdbtools works only with .mdb files but not with accdb files...Elevon
@Gilles It worked in my case, I don't know why it didn't work for you, for me it works for these databases: ars.usda.gov/northeast-area/beltsville-md-bhnrc/…Melanochroi
@Gilles maybe you have an older mdbtoolsMelanochroi
@Gilles I looked now and the .accbd I worked with were saved to be compatible with Access 2007, maybe you have a newer version access file that is not supported by mdbtoolsMelanochroi
My version of mdb-tools is 0.7.1. I can confirm that your code works on the linked database and also on several other .accdb found online (eg here : catalog.data.gov/dataset?q=accdb ). But with the .accdb file I'm working with (that I can't share) I get the following message Unknown Jet version. Couldn't open database.. It works with the acess2csv.jar solution proposed by @Richard-d but without column headers. Your solution is very nice in most situations !! Thanks !!!Elevon
M
2

I found this blog: http://tahsinabrar.com/open-a-microsoft-access-accdb-file-in-ubuntu/ In case the link is broken, the contents say:

We can use the UCanAccess JDBC driver to connect to Access databases (.mdb and .accdb) in LibreOffice Base. Here’s how I did it on a clean install of Ubuntu 14.04 LTS.

First, I installed LibreOffice Base itself

sudo apt-get install libreoffice-base

Then I downloaded UCanAccess to my Downloads folder and unzipped it.

I launched LibreOffice (not Base, just LibreOffice itself)

LibreOffice.png

and chose Tools > Options

On the Advanced tab I clicked the “Class Path…” button and then added the following five (5) JAR files using the “Add Archive…” button:

/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/ucanaccess-2.0.9.5.jar /home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/commons-lang-2.6.jar /home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/commons-logging-1.1.1.jar /home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/hsqldb.jar /home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/jackcess-2.1.0.jar

Note that you must close and re-open LibreOffice for the new Class Path values to take effect.

Then I launched LibreOffice Base, and in Step 1 of the wizard I chose “Connect to an existing database (JDBC)”

The Access file I wanted to manipulate was named “baseTest.accdb” in my Downloads folder, so in Step 2 the “Datasource URL” was

jdbc:ucanaccess:///home/abrar/Downloads/baseTest.accdb

and the “JDBC driver class” was

net.ucanaccess.jdbc.UcanaccessDriver

In Step 3, I left the “User name” field empty and just clicked “Next

”.

In Step 4, I saved the LibreOffice Base database as “accdbTest.odb” in my Documents folder.

When the wizard completed it opened my LibreOffice database and I could see the tables in the .accdb file

But you have download and unzip UCANACCESS first from here: http://ucanaccess.sourceforge.net/site.html

I can see all the tables in LibreOffice Base. Here is one:

tableimg

Makhachkala answered 4/12, 2020 at 22:58 Comment(1)
As noted at the end of the blog post, those instructions were lifted directly from my Ask Ubuntu answer here.Himyarite
B
1

This may be of interest: How to convert accdb to a postgres database

I am not sure if Wine would suit, but it might be worth a look.

Brunn answered 30/11, 2009 at 21:11 Comment(0)
C
0

I guess you want to extract data from tables, not code from modules. I do not know specifically Ubuntu but I guess you can connect to the access file using an ODBC connection (or, if available, OLEDB connection) and extract the data? Depending on the connection type, you might still need to know the tables names in order to import them.

Cyanide answered 1/12, 2009 at 10:16 Comment(1)
Jet/ACE only runs on Windows, so you'd need some other library for replicating the functionality that Jet/ACE offers. Tony has offered all the ones that I'm aware of.Terrell
I
0

Microsoft Access Runtime is a free software. You can install it in Ubntu using Wine and then open the accdb database.

Isabellaisabelle answered 1/7, 2010 at 14:25 Comment(1)
The runtime gives you no tools to edit a database. It only allows you to run an application built in Access. Also, the Wine AppDB rates full A2007 as only Bronze level of support (appdb.winehq.org/objectManager.php?sClass=version&iId=16862), but that's for the full version not the runtime (I assume).Terrell
E
-8

Im not sure if there are any native tools, but you can always install a copy of windows and install a free view for accdb files or install a trial of Access.

Eatton answered 30/11, 2009 at 21:11 Comment(2)
yeah, you can always install windows.Carolyncarolyne
This is the expensive answer I was trying to stay away from.Fechter

© 2022 - 2024 — McMap. All rights reserved.