Export mysql database to Microsoft Access (.mdb) - php

I'm looking for some tips on how to export a mysql database into a .mdb file that is readable by Microsoft Access 2007+ (and editable too!). It needs to be a script that can run on a Linux server (maybe using PHP?).
I can't seem to find out anything anywhere. Any ideas?
Cheers!

Thanks for your tips :)
I have since found out we're already using this product elsewhere:
http://dbconvert.com/convert-access-to-mysql-pro.php?DB=1
It's running under Wine on our server, although I don't think it supports the latest versions of Access.

Install the ODBC driver from MySQL.
Create the ODBC system DSN entry.
On Access, execute a query like this:
SELECT * INTO AccessTable
FROM [ODBC;DATABASE=Database_Name;DSN=DSN_Name;OPTION=2059;PWD=MySQL_Password;PORT=0;UID=MySQL_User].MySQLTable
(Replace accordingly: AccessTable, MySQLTable, Database_Name, DSN_Name, MySQL_Password, MySQL_User)

You could create a a CSV file from MySql and then import that into Access. You can use OLEDB or ODBC connection to access and should be able to do the inserts that way.
Are you also trying to create the mdb file on the fly? I'm assuming that you have one built already and just want to export the data from mysql and import into access.

I have not tried this.
The unixODBC Project goals are to
develop and promote unixODBC to be the
definitive standard for ODBC on non MS
Windows platforms. This is to include
GUI support for both KDE and GNOME.
-- http://www.unixodbc.org/

Related

Create a DSN for the function odbc_connect for Oracle

The information I have concerning the Oracle database O need to connect to using PHP through EasyPHP is the following: user, password, host, port, service. I'm new to ODBC. I tried to use the function odbc_connect, but I keep getting errors simply because I don't know how to make a DSN.
I tried using this:
$dns_db="DRIVER={DataDirect 32-BIT SequeLink 5.4};HOST=localhost; PORT=2399;ServerDataSource=maDB;"
But I don't know what {DataDirect 32-BIT SequeLink 5.4} means, and it seems like I need to know the database name so I can put it in the ServerDataSource.
How do I make this DSN thing?
That should be the driver name as it shows up in the ODBC manager. In my computer I have Microsoft ODBC for Oracle and Oracle in instantclient_11_2 to choose from:
Try to use a driver provided by Oracle; the Microsoft one lacks many basic features.
But I'd recommend you to create a system ODBC so you can assign a name of your choice and simply refer to it by such name. Additionally, that allows to configure additional options with the driver's GUI:
Last but not least, my final advice is to dump ODBC completely and use the OCI extension. Coding a PHP app with ODBC is frustrating.

Connect PHP with Paradox .db file on linux server

I have the following situation:
I have to integrate a website (php on linux server) with an old app (Delphi and Paradox (.db file) on Windows)
I need get data from paradox database and show them in the website. I can get transfer the .db file by FTP.
I don't think that I can install external libraries.
I did not find any command line program on Windows to convert from .db file to mysql or any format that supports PHP.
In addition, Paradox database is updated daily.
Does anyone have any solution or tip or anything?
Probably best is to write a new stand-alone application for the Windows host that is linked against both the Paradox libraries and the PostgreSQL libraries; make queries against the Paradox database and write the data to the PostgreSQL database.
If you wanted to go half-way and write a tool that dumps the Paradox database into a CSV format for later import on the PostgreSQL end, that could work too, but there is enough hassle in CSV formats that doing the entire transition Paradox -> PostgreSQL in one application seems like the best approach to me.
I found here the solution to get data from a paradox .db file without DBE.
Regards.

Access from PHP to .mdb file on Ubuntu

I've got a problem of obtaining access to .mdb file (MS-Access db) on Ubuntu. I need full access(read and write too).
Originally project was built on Windows using odbc (and everything has worked well). But when I moved it on linux-server appeared problems.
At the moment PHP-extensions for work with odbc are installed. But I can't find any free ODBC-driver for work with Access. I've tried to use MDB Tools but seems it works only for reading.
Maybe somebody can suggest any solution? Usage of some another DB is not appropriate, because my boss is against it.
Thanks for any help.
By installing mdbtools from the Linux repository you can work with mdb in Linux.
mdbtools is a free package that can solve your problem.
Take a look at this tutorial
You can read/write MS Access files using ADODB, the PHP libraries for ADODB can be found here:
http://adodb.sourceforge.net/
Thanks everybody for your help. Finally we decided to use another DB. My answer on this question - it's impossible(if you need to write to DB) to use Access DB on linux based only on free solutions. If you need only read you can use MDB tools with PDO. If you're ready to pay you can try EasySoft solutions.
I've just used RebaseData
apt-get install curl libreoffice-calc
curl -F files[]=#example.mdb https://www.rebasedata.com/api/v1/convert?outputFormat=csv -o output.zip
You can link the access database to a free SQLServer Express Edition. Then you can insert or select data from any access table using freetds and unixodbc from your linux box. Yes, you need a windows box in your network with the access file and the SQLExpress service. Any database with windows support (DBF, XLS, etc.) can be used this way.

Pervasive & Linux

I'm interested in quering a Pervasive DB server running on a Windows platform from Linux.
Would anyone happen to know if this is possible, what's required and what resources there are for me to read up on it?
Thanks!
What version of Pervasive are you using? All versions since v8 (including v9 and v10) support a Linux client which is included with the Pervasive.SQL server engine. V9 and V10 clients are also available for download from the Pervasive website (http://www.pervasivedb.com/Database/Products/PSQLv10/Pages/PSQLOverview.aspx). Once you've got a client installed on the Linux machine, you can create an ODBC DSN or use the Btrieve API to access the data.
Most database have at least a command line client to connect to database. check your brand of database to see if you have such tools. For example, Mysql has mysql command line client for making query to MySql database. Otherwise, another way is you might want to try setting up ODBC with Perl.

Connecting to Oracle using PHP

How do I connect to a remote Oracle database instance from PHP?
I need to query (read only) the remote Oracle database for some information; do I need to have an Oracle Instant Client installed?
Is the OCI extension for PHP enough?
From PHP Manual
You will need the Oracle client libraries to use this extension.
The most convenient way to install all the required files is to use Oracle Instant Client, which is available from Oracle's site
The best manual for using PHP with Oracle is Underground PHP Oracle Manual. Periodically updated. For example last update describe new cool OCI (Oracle Call Interface) features. I found it by accident and since then has never regretted. Start from that good manual.
there are a couple of steps you need to go through to make this work.
First, you need to install the oracle driver for whatever OS you have. Then, create a DSN for odbc to use to connect the php function call to the oracle database. On windows, you can find this on the Control Panel -> ODBC Sources
Once you have done this, restart the DB, the web server and then you should be able to test it all with this:
odbc_connect($dsn,$user,$pass);
If you have linux, the same steps are needed but I'm not sure how you create a DSN in unix.
I saw this in the "Notes" section of the PHP documentation:
If you're using PHP with Oracle Instant Client, you can use easy connect naming method (...)
So I think it's rather clear that you can connect to an Oracle DB without the Oracle Instant Client, using only the PHP Oracle extension.
If you're attempting to connect to oracle on ubuntu with PHP, the following links have been more than helpful:
A) http://pecl.php.net/bugs/bug.php?id=9253
That's the real-workhorse one - it gives you just about all the data you need.
B) http://fabrizioballiano.net/2008/01/26/how-to-install-php-pdo_oci-on-ubuntu-gutsy/
This is also helpful for details of things that need to be installed for oracle to work with ubuntu.
If you're using it with PHP, you'll need to make sure that the TNS_ADMIN and ORACLE_HOME environment variables are available for apache's user - there's a file named 'envvars' in the apache2 directory where you can set these. (For my own ease of use, I have the two point to the same directory.)

Categories