Exporting a Mysql database to Access? - mysql

I see there are multiple ways to do exports from mysql - the list phpmyadmin provides is given below:
I vote for the easiest way. For example I can get a .sql file from the SQL option but I don't know where to go from there. Likewise I can get a .php file but I don't know how to parse it from there into Access. Thanks!
Codegen, CSV, CSV for MS Excel, MS Word 2000, latex, Media Wiki Table, Open Document Spreadsheet, Open Document Text, PDF, PHP Array, SQL, Texy text, Excel 97-2003, Excel 2007, XML, YAML
Export Working: PHP Array(.php), SQL (.sql)
Export Not Working: XML
Ambiguous: Excel 2007

I would install a MySQL ODBC driver, create a DSN pointing to your MySQL database, then use the Access UI option to import from ODBC. If you want a code approach, use the DoCmd.TransferDatabase Method
Alternatively, you could create ODBC links in Access to your MySQL tables, then run "Make-Table" queries to create Access copies of those tables:
SELECT * INTO new_access_table
FROM mysql_linked_table;

Related

Cannot open .accdb files because Access looking for hard-coded path

I have received a few .accdb files from a client, and I am trying to open them in Microsoft Access 2013. The files seem to open correctly, but whenever I click on any of the tables or queries on the left I get the following error message:
C:\[hard-coded path on client's computer] is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
Now, I know that the path does not exist on my computer. But why is Access looking for a hard-coded path on another person's computer? And how can I access the tables and queries in Access?
Additional question: Is there an easy way to import the data to SQL Server instead? I read a couple of posts about importing data from Access to SQL Server, but apparently the SQL Server Import and Export Wizard is expecting a file of a different format, not .accdb.
Thanks in advance.
You need to get the back-end database file from your client. All the tables are stored there. Once you receive it, save it at a convenient location on your computer and use the "Linked Table Manager" on the "External Data" tab in the .accdb you already have. That will allow you to update the table links for the current location of the back-end database file on your system.

Easiest way to continually import data to MySQL from a dbf file on my local computer

I have a problem that has been annoying me for quite some time now and a few days ago I started googling for a solution, but I haven't really gotten anything to work. I've read a little about something called SSIS, but I'm not sure it does what I'm looking for or if there is something else I should research in order to accomplish my goal. This is my problem:
My accounting program produces and updates a .dbf file with information about all vouchers and places it in a folder on my local computer. Our MySQL must continually be updated with this information. So this is what I do twice a day:
I open up the .dbf file in excel
Save it as a .csv.
Close Excel
Open the file in notepad++
Convert the formating to utf8
Save
log in to MySQL
Go to the right table
Upload the .csv
Replace the old data with the new
As this takes quite a bit of time, I feel that there must be better ways to do this. It would be great if I could have this scheduled to be done automatically or if there is some kind of an SQL query that could do this, because then I could use PHP to make a website that I could enter and have the query run when I press a button or something.
So my question is: What is the most simple way to continually get the info from the .dbf file into my SQL server?
There is a way to do your job by shedule with DBF Commander Pro's command-line interface. Use the following command in a *.BAT file:
dbfcommander.exe -edb <dbf_file_name> <server_table_name> <connection_string>
After that, create a shedule for this BAT file using Windows Sheduler.
The only issue remains, that you need to clear the destination table on MySQL database before the export process.
In order to try the export process in app GUI, click 'File -> Export to DBMS'. In the window appears click Build button in order to build the connection string: select MS OLEDB Provider for MySQL Server, then choose your server from the list, provide login and password, select a database, click OK:
In the Export to DBMS window select the destination table you want to import source DBF file to, then click Export. The command line you need you can find at the bottom part of the window.
More info on import and export DBF to a database you can find here. Detailed using of command-line is here.
As you mention of doing in PHP. What is stopping you from doing it there.
You could create one connection handle using a VFPOleDB provider to open the path location of the table, open and read the table. Then have a SECOND connection to your MySQL database open and ready to push the data there.
Then, for each row read from the VFP OleDB connection result set, do whatever special cleansing you need to.
Then, query from the MySQL connection if its an existing entry or not and if an add or update is necessary, then send the data respectively.
Continue for the rest of the records from the VFP result set.
No need to open in Excel, save to CSV format, load yet another tool, etc...

Automatic adding data from excel to table in MySQL

I would like load data from excel file to table. The problem is that I would like do it evry day, because data are adding to excel file in each day.
I have no problem with write script which will add data from excel to table (I use LOAD FILE) but I have problem with automatic launching these script. Is it possible in MySQL (best in MySQL WorkBench)? I need some materials, because I have never done it. I will grateful for your help.
use VBscript to call excel macro that fill the data to file then use solway's task scheduler (freeware) to execute the VBscript
for connecting to mysql via VBScript use the following
Install MySQL Connector/ODBC 5.1 and use a connection string like the following
connectionString = "Driver={MySQL ODBC 5.1 Driver};Server=yourServerAddress;Database=yourDataBase;User=yourUsername; Password=yourPassword;"

Download MySQL table as a spreadsheet

How do you download an sql table as an Excel spreadsheet?
Any help would be appreciated.
Thanks
Use a SELECT ... INTO OUTFILE ... statement to write a CSV file or a tab-delimited file that you can open directly in Excel.
Navicat, MySQL Workbench and phpMyAdmin would all work if you want to create the spreadsheet yourself.
To allow users to download spreadsheets from a website, you can use a library. Some good options are:
IIS:
EPPlus http://epplus.codeplex.com/ or NPOI http://npoi.codeplex.com/
Apache:
PHP Excel (http://phpexcel.codeplex.com/) or Apache POI (http://poi.apache.org/)
Use phpMyAdmin, it has option of exporting thata to multiple formats:
csv,scv for excel, json, doc, latex, wiki table, odf, pdf, sql
Use a database client like Navicat.

Import Excel Data programmatically to access table with column mapping

I am in search of a tool / VBA code snippet that can port my excel data to my access table with effective columns mapping. Anybody please share if you have any idea on these.
Thanks in advance
The standard way to import or link Excel in Access is to use the TransferSpreadsheet method of the DoCmd object. The link is for 2007, but it has been available certainly since 2000, if not before. TransferSpreadsheet includes a HasFieldNames argument.
In Access 2007 you can use External Data/Import/Excel
Just follow the wizard to select the workbook, type of connection, sheet and data.
Data can be imported to a new table, appended to an existing table, or as a linked table
In Access 2003 its File/Get External Data/Import or File/Get External Data/Link tables
select file type .xls and browse to the workbook
if this task is something that u need to perform on a regular basis, you may want to consider creating a macro and scheduled task to perform this automatically. it is very easy to settup and I can outline procedure if need be