Open access file linux

How to use an ms-access file from linux?

Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. Although it is primarily designed for use on Windows, it can also be used on other platforms such as Linux, with some limitations. If you want to use an MS-Access file on a Linux system, there are a few options available to you.

Method 1: Wine

To use an MS-Access file from Linux, we can use Wine. Wine is a compatibility layer capable of running Windows applications on Linux. Here are the steps to use an MS-Access file from Linux with Wine:

Step 1: Install Wine

First, we need to install Wine on our Linux system. Here is the command to install Wine on Ubuntu:

Step 2: Install MS-Access

Next, we need to install MS-Access on Wine. We can install it by following these steps:

  1. Download the MS-Access installer from Microsoft website.
  2. Open the terminal and navigate to the directory where the installer is downloaded.
  3. Run the following command to start the installation:

Step 3: Open MS-Access file

Once MS-Access is installed, we can open the MS-Access file by following these steps:

  1. Open the terminal and navigate to the directory where the MS-Access file is located.
  2. Run the following command to open the MS-Access file:
wine msaccess.exe /path/to/access/file.accdb

This will open the MS-Access file in Wine, and we can use it just like we would on a Windows system.

Method 2: Virtual Machine

  1. Install VirtualBox on your Linux machine.
  2. Download the Windows ISO file and create a new virtual machine on VirtualBox with Windows as the guest OS.
  3. Install Microsoft Access on the Windows virtual machine.
  4. Share the MS-Access file from the Windows virtual machine to the Linux host machine by adding a shared folder in VirtualBox.
  5. Mount the shared folder on the Linux machine by running the following command:
sudo mount -t vboxsf shared_folder_name /mnt/mount_point
  1. Access the MS-Access file from the mounted folder using ODBC connection. Install ODBC drivers for MS-Access on the Linux machine and configure the connection string in your code.
import pyodbc conn_str = ( r'DRIVER=;' r'DBQ=/mnt/mount_point/path/to/access_file.accdb;' ) conn = pyodbc.connect(conn_str) cursor = conn.cursor() cursor.execute('SELECT * FROM table_name') rows = cursor.fetchall() for row in rows: print(row)

That’s it! You can now use the MS-Access file from your Linux machine using VirtualBox.

Читайте также:  Chromium гост astra linux

Method 3: Remote Desktop Connection

sudo apt-get update sudo apt-get install xrdp
rdesktop windows_machine_ip>
cd "C:\Program Files\Microsoft Office\OfficeXX" msaccess.exe "C:\path\to\your\file.accdb"
  1. You can now use your MS-Access file from your Linux machine through the Remote Desktop Connection.

Note: Make sure that your Windows machine has Remote Desktop enabled and that your Linux machine can connect to it. Also, make sure that you have the necessary permissions to access the MS-Access file.

Method 4: Converting to Other Database Format

sudo apt-get install mdbtools
mdb-schema file.mdb | sqlite3 file.sqlite for i in $(mdb-tables file.mdb); do mdb-export -I sqlite file.mdb $i > $i.sql; done for i in $(ls *.sql); do sqlite3 file.sqlite  $i; done
mdb-schema file.mdb mysql | mysql -u username -p -h localhost dbname for i in $(mdb-tables file.mdb); do mdb-export -I mysql file.mdb $i | mysql -u username -p -h localhost dbname; done
mdb-schema file.mdb postgres | psql -h localhost -U username dbname for i in $(mdb-tables file.mdb); do mdb-export -I postgresql file.mdb $i | psql -h localhost -U username dbname; done

Note: Replace «file.mdb» with the name of your MS-Access file, and replace «username», «dbname», and «localhost» with your own MySQL/PostgreSQL settings.

This method allows you to use an MS-Access file from Linux by converting it to another database format. You can then access the converted data using the appropriate database tools and libraries.

Источник

How to open an .accdb file in Ubuntu?

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?

9 Answers 9

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.

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).

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.

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.

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 

@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/…

@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 mdbtools

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 .

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:

Источник

Оцените статью
Adblock
detector