Подключение access к 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.

Читайте также:  Интерфейс командной строки линукс

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.

Источник

Access ODBC Driver Getting Started Guide

How to connect to Microsoft Access from Linux and Unix.

This guide shows you how to download, install and license the Access ODBC driver.

If you are evaluating the Access ODBC driver, the guide will show you how to obtain a free trial license.

Before You Begin

Is the Access database file (.mdb or .accdb) located on the Access ODBC driver machine? If the database file is located on a remote Windows share, your system administrator needs to mount the remote directory on the Access ODBC driver machine. Refer to the Access ODBC Driver User’s Guide for help with this.

Prerequisite Software

If Windows users also access the database file you want to open with the Access ODBC driver, the libsmbclient library is required. Your system administrator needs to install libsmbclient, which is part of the Samba suite, on the Access ODBC driver machine.

What You Need To Know

Obtain this information from your system administrator:

If the database file is located on a Windows or Samba share, obtain this information:

  • The name or IP address of the machine on which the share is located.
  • The share name.
  • The subdirectory in which the database file is located (if applicable).
  • The path to the libsmbclient library on the Access ODBC driver machine.

Step 1: Download the Access ODBC Driver Distribution

  1. Log in at http://www.easysoft.com. If you have not yet done so, you need to register first. On the registration form, an asterisk (*) indicates that a field is mandatory.
  2. Download the Easysoft ODBC-Access Driver distribution for your Unix platform.
  3. Save the distribution file to a temporary directory on the machine where you want to install the Access ODBC driver.

Step 2: Install the Access ODBC Driver

Note You need root access on the machine where you want to install the Access ODBC driver.

    Log in to your Unix system and cd into the directory where you downloaded the Access ODBC driver distribution. For example:

tar -xvf odbc-access-version-platform.tar

Replace version and platform with the version number and platform contained in the distribution file name. For example, to unpack the 32-bit Linux distribution:

tar -xvf odbc-access-1.0.0-linux-x86-glibc.tar
cd odbc-access-1.0.0-linux-x86-glibc
[0] Exit [1] View existing licenses [2] ODBC-Access Driver V1.0 Please choose the product you would like a license for by entering its item number or enter one of the other options. Option: 2
  1. Your full name
  2. Your company name
  3. An email contact address. This must be the email address you registered on the Easysoft web site.
  4. Your telephone number (you need to specify this if you telephone the license request to us).
  5. Your fax number (you need to specify this if you fax the license request to us).
  6. A reference number. When applying for a trial license just press ENTER. This field is used to enter a reference number we will supply you for full (paid) licenses.

The License Client asks you to choose a method for obtaining the license. To obtain a license automatically, you need to be connected to the Internet and allow outgoing connections to license.easysoft.com on port 8884. If you are not connected to the Internet or do not allow outgoing connections through port 8884, the License Client can create a license request file which you can:

If you choose option [2], the license request is written to a file named license_request.txt and you should exit the License Client (option [0]) and complete the installation. Once you have mailed, faxed or telephoned the license request to us, we will return a license key. Add this to the end of the file /usr/local/easysoft/license/licenses .

At the end of the installation, you will have installed and licensed the Access ODBC driver, installed the unixODBC Driver Manager and created an ODBC data source.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/easysoft/access:/usr/local/easysoft/lib export LD_LIBRARY_PATH

Step 3: Connect to an Access ODBC Driver Data Source

mdbfile = /home/myuser/ms_access/Northwind.mdb
mdbfile = /home/samba/ms_access/Northwind 2007.accdb
mdbfile = /mnt/access_windows/Northwind.mdb

where: host is the name or IP address of the machine on which the share is located. share is the share name. path specifies any subdirectories under share. filename is the database file name, which should be the same one as specified by the mdbfile attribute. For example:

smbpath = smb://access_odbc_driver_machine/accounts_share/ms_access/Northwind 2007.accdb
smbpath = smb://windows_machine/accounts_share/ms_access/Northwind.mdb
smblib = /usr/lib/libsmbclient.so

Example

# This Access ODBC Driver data source opens an Access database that is stored on # a Samba share on the Access ODBC driver machine. The data source opens the # database for shared read/write access; other users can open the database # therefore. [ACCESS_SAMPLE] Driver = Easysoft ODBC-ACCESS mdbfile = /home/samba/accounts_share/ms_access/Northwind.mdb # The SMB URL for the database stored on the Samba share. smbpath = smb://access_odbc_driver_machine/accounts_share/ms_access/Northwind.mdb # The path to the libsmbclient library on the Access ODBC Driver machine smblib = /usr/lib/libsmbclient.so # The user name and password of a Samba user who has read and write access to the # share. smbuser = mysamba_user smbauth = mysamba_password # Opens the database for shared read/write access. readonly = no exclusive = no
cd /usr/local/easysoft/unixODBC/bin ./isql -v dsn_name 

What Next?

You are now ready to use the Access ODBC driver with your own applications and development tools on your client machine.

Further Support

  • The Easysoft ODBC-Access Driver User’s Guide provides detailed installation instructions. This manual is also available as a PDF.
  • For help on solving some common connection problems, visit the Easysoft ODBC-Access Driver Knowledge Base.
  • To contact the Easysoft support team, send an email message to .

Источник

Microsoft Access

Чтобы получить доступ к файлам .accdb и .mdb под Linux, необходимо установить пакет ucanaccess и добавить классы в LibreOffice. Подразумевается, что пакеты LibreOffice (или LibreOffice-still), а также java-1.8.0-openjdk уже установлены.

apt-get update apt-get install ucanaccess

2. Открываем LibreOffice Writer из меню и переходим в Сервис → Параметры… → Расширенные возможности. Нажимаем кнопку «Путь класса…». В появившемся окне, нажимая кнопку «Добавить архив…» поочерёдно добавляем пять архивов .jar из /usr/share/java:

LibreOffice-add-jars.png

3. Перезапускаем LibreOffice.

4. Запускаем LibreOffice Base и выбираем «Соединиться с существующей базой данных» → JDBC.

LibreOffice-create-batabase.png

5. Заполняем поля источника и драйвера:

URL источника данных (открываем файл /home/cas/Contacts_Demo_V1.01.mdb )

ucanaccess:///home/cas/Contacts_Demo_V1.01.mdb
net.ucanaccess.jdbc.UcanaccessDriver

LibreOffice-set-jdbc-driver.png

Примечание: Для проверки работы драйвера на этом этапе можно нажать кнопку «Тест класса». При успешной установке появится окно «JDBC драйвер успешно загружен».

6. Нажмите «Готово». Будет предложено создать новый файл базы данных. Укажите имя и ваш файл mdb будет открыт в LibreOffice Base:

LibreOffice-open-mdb.png

Использование Kexi

Также файлы .mdb вы можете открыть в программе Kexi. Установите

Примечание: Если вы не используете KDE5, то также установите kde5-profile и перезапустите сеанс.

Ссылки

Источник

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