Using MS Access as a front-end to MySQL db - mysql

I am using MySQL DB for my android application. I have installed phpmyadmin on my Ubuntu LAMP server and using it to access my DB. Is there any possibilities to access the DB using MS access 2010, as I need to do perform modifications on a regular basis to my DB

If the aim is to change the data and not the structure, using MS access is a good solution, as you can edit anything in linked tables very efficiently with litlle setup efforts.
To achieve this, first you need to download and install the MySQL ODBC driver.
In order to avoid issues, I advise you to install the 32 bit driver, even if you're on a 64 bit system. The 32bit will work flawesly, which is not always the case of the 64 bit.
Once installed, open the ODBC control panel and add an entry pointing to your MySQL database
Then in Access you can add linked tables using this ODBC entry
Once the table are linked, they will behave as if they are MS access tables and you can open them and edit data, and much more.

You can use Microsoft Access as a front-end to your MySQL database.
Refer: MySQL Documentation
But for your case, directly accessing database is wrong. I suggest better you have a view page with php to update DB with proper required validations.

The answer by Thomas G does an excellent job of describing WHAT we need to do, and even provides some good links.
What we need now is a good, step-by-step description of HOW to accomplish all the steps Thomas G describes.
I've been looking for this for a long time, and still no luck. However, I'm possibly on the track of getting that answer, and if I find it, I'll come back here and post it.

Related

Adding MySQL functionality in LabView

I am new to LabVIEW and trying to make a small project. In LabVIEW from one device, I am measuring some values and then need to store them in database. Initially, I used Excel to store data. But now I need to add MySQL functionality to store data and then later retrieve when need for analyzing.
I look for NI toolkit but it is expensive. I need some free and open source solution for my project.
I search over SO and google to find any examples where I can start and make it work, but I couldn't find any.
If someone suggest me some resources or having some example code that I can use to achieve my goal. thanks in advance.
Take a look at LabSQL. This works in LabVIEW 2017, allowing connection to a MySQL database without NI's LabVIEW Database Connectivity Toolkit.
I normally use the Database Connectivity Toolkit, but I did confirm I could get this to work in 2017 as well (though connecting to a MSSQL database instead of MySQL).
The only thing that tripped me up at first was not using the Create Connection before Open Connection (because I was used to the aforementioned toolkit). I didn't try anything complicated; I just ran a simple selection query. But it looks like everything should work pretty similarly to the toolkit. As adambro said, if you have a more specific question, maybe we can help with an answer.
I would suggest you could use SQLite. It is a fairly easy toolkit. You can download it via the VI package manager. By dr. James Powell. SQLite is excellent in storing data locally.
Use the SQLite browser from sqlitebrowser.org.
Also a nice way to learn SQL!

MS ACCESS - MYSQL personalized sync

I have to connect two existing databases: a ms access one (Access 2010) stored on al local server (Windows Server 2008 R2) and used by my company, which can't be modified in the structure except to add new fields (my collegues absolutely don't want to change); and a mysql one stored on a server on-line and from which the data are picked up by a PHP program (this means that it would be very onerous to change the structure for me). The structure of these two databases is similar but not completely identical: for example i need to put the data of two tables of the access into only one of the mysql, and the names of the fields are completely different from a database to another. Can anyone suggest me a software to connect and synchronize them (even once a hour)? I know there are several options like ODBC connector offered directly from mysql.com but i've had problems installing it, and I've also tried that: https://dbconvert.com/mysql/access/ but it seems to not support my version of access db so I wasn't able to understand if these two solutions were adaptable to my situation. Does someone who has faced a similar problem and who is more experienced than me suggest an easy solution? Should I try harder with the two "solutions" i mentioned? Sorry for the ignorance, I trust you :)
Have an Access file use linked tables to the Access DB and linked tables via ODBC to MySQL, this method works well. Look into improving your ODBC Connection.
I found the 32 bit version of ODBC to MySQL gave me better results, linking from Access 2003.

Can I copy my MySQL database structure to MS Access pre 2007?

I want to create a desktop version of my mysql installation without having to setup a server on my machine.
I want to make use of MS Access' query designer so I can produce complicated queries.
I know I can produce an SQL file but I've no idea how to create an MS Access database from it ?
I'm not going to jump on the "Access sucks" bandwagon, though it can be very frustrating at times.
Worst case, You can start with a blank Access database (mdb file, since you specified pre-2007). Open the query designer & go to SQL view. Paste in one complete SQL statement (CREATE TABLE...), and run it. Fix any incompatibility errors, paste in the next (replacing the first), rinse, repeat. Be sure to do this in such order that any dependency "sources" get created before the dependents.
There may be a batch process available, but I don't know what it is offhand.
Moving from MySQL to something like Access is heading in the wrong direction.
If you need a server-less SQL installation or package as part of your distribution (which is a pretty common requirement these days since admins don't like users to install database servers on their machines), consider SQL Server Compact Edition (CE) or SQL Lite. They're both fully SQL compliant (unlike Access) and will cause you far fewer headaches than Access (which sucks). (Did I mention that Access sucks? Big time?)
SQL CE is a .NET assembly that runs in-process with your app, and is very easy to work with. Also, db objects you create will be upwards-compatibile with the full-blown SQL Server. It also works very, very well with Entity Framework if you're into ORMs.
I've heard praise for SQLite, but haven't worked with it. If you're not on .NET, this should be a good way to go.
Links:
SQL CE
SQLite
I don't know if this is a viable option, but if you can set up a DSN to point to your MySQL server, you can then use FILE | GET EXTERNAL DATA | IMPORT to import your MySQL tables into a blank MDB/ACCDB. It's a one-time operation, but I don't know that there's any other option here. You should get the option to import the table schema only and not schema+data. You may have to tweak data types in the resulting tables, since the MySQL data types won't necessarily map directly to Jet/ACE data types.
Then you can carry the MDB/ACCDB file anywhere you want.

Porting from MS Access

I've recently been given a MS Access .mdb database file and asked to make it usable in a Linux system. What I'm looking for is a way to convert the Access database to an open-source database such as MySQL or PostGres.
I don't have MS Office, and it's a one-time project for a volunteer organization so I don't want to spend money if it's avoidable. I'm running Vista x64, and have a Linux virtualbox, so something usable in either one will be good.
Forunately you don't need MS Access to get data out of an Access database. While there are tools like MDBTools that will read .mdb files on Linux, I've found them to be unstable for larger, more complicated databases. The best way is to use ADO or ODBC on Windows to export the data from the .mdb database into a format you can import somewhere else (like csv).
I've had good luck using DBI with Ruby, or using ADO in a Ruby script.
Following links may be useful for you.
MySQL:
access migrate
read.php?65,27115,27115
PostgreSQL:
Microsoft Access to PostgreSQL Conversion
Converting from other Databases to PostgreSQL
I used the MySQL Migration Toolkit and it worked very well for tables, even creating a reusable script. It is free and simple to use.
This toolkit is now EOL and the MySQL Workbench 5.2 replaces it.
Unfortunately, it falls over with "A problem caused the program to stop working correctly" when I try it with MS Access on my system. At the last step, of course. (Jan 16 2013)
Either MySQL or Postgres will work fine as a replacement data store for your access data. If your Access database contains Forms or Reports there really isn't a direct replacement in Open Source, and you'll either need to retain the Access front end and access the data using ODBC drivers, or code a new series of Forms or Reports in PHP or your favorite web scripting language.
I had the same problem now, and found this freeware to be exactly what I needed: http://www.bullzip.com/products/a2m/info.php
It extracted everything from the MDB file generated an SQL file I imported directly into my MySQL server.
There are two parts to the process
1) convert from Access database to scripts, there are some good options although you may need Access and potentially Sql Server too, to do this
2) Pick your target database - MySql would seem like a good fit, run it up on Linux or Windows and run the ddl and data in from the scripts.
Not sure how you can do this without Access though, do you have any idea what the schema looks like? If you do run into probs I could help out with step 1, but I don't have a Linux install at the moment.
i beg to differ: there is no need to use external tools or costly middleware. the simplest, cleanest, cheapest, fastest, safest (did i say BEST?) solution is using ODBC and integrating fully.

Issues using MS Access as a front-end to a MySQL database back-end?

Two users wanted to share the same database, originally written in MS Access, without conflicting with one another over a single MDB file.
I moved the tables from a simple MS Access database to MySQL using its Migration Toolkit (which works well, by the way) and set up Access to link to those tables via ODBC.
So far, I've run into the following:
You can't insert/update/delete rows in a table without a primary key (no surprise there).
AutoNumber fields in MS Access must be the primary key or they'll just end up as integer columns in MySQL (natch, why wouldn't it be the PK?)
The tables were migrated to MySQL's InnoDB table type, but the Access relationships didn't become MySQL foreign key constraints.
Once the database is in use, can I expect any other issues? Particularly when both users are working in the same table?
I know this topic is not too fresh, but just some additional explanations:
If you want to use MS Access effectively, especially with bigger, multiuser databases, please do the following:
split your MDB into frontend application and backend (data only) files - you'll have two separate MDB files then.
migrate all the tables with data and structure into external database. It can be: MySQL (works very well, no database size limitations, requires some more skills as it's not MS technology, but it is a good choice in many cases - moreover you can scale your backend with more RAM and additional CPUs, so everything depends on your needs and hardware capabilities); Oracle (if you have enough money or some kind of corporate license) or Oracle 10g XE (if this is not a problem, that the database size is limited up to 4 GB and it will always use 1 GB of RAM and 1 CPU), MS SQL Server 2008 (it's a great pair to have MS Access frontend and MS SQL Server backend in all the cases, but you have to pay for license! - advantages are: close integration, both technologies are form the same vendor; MS SQL Server is very easy to maintain an effective at the same time) or Express edition (same story like with Oracle XE - almost the same limitations).
relink your MS Access frontend with backend database. If you selected MS SQL Server for the backend then it will be as easy as to use the wizard from MS Access. For MySQL - you have to use ODBC drivers (it's simple and works very good). For Oracle - please do not use the ODBC drivers from Microsoft. These from Oracle will do their work much better (you can compare the time needed to execute SQL query from MS Access to Oracle via Oracle ODBC and MS Oracle ODBC drivers). At this point you'll have solid database backend and fully functional MS Access frontend - MDB file.
compile your MDB frontend to MDE - it will give you a lot of speed. Moreover, it's the only reasonable form of distributing MS Access application to your end users.
for daily work - use MDE file with MS Access frontend. For futher MS Access frontend development use MDB file.
don't use badly written ActiveX components to enhance MS Access frontend capabilities. Better write them yourself or buy the proper ones.
don't believe into the myths that there are a lot of issues with MS Access - this is a great product which can help in may occassions. The problem is a lot of people assume it's a toy or that MS Access is generaly simple. Usually they generate a lot of errors and issues by themselves and their lack of knowledge and experience. To be successfull with MS Access it is important to understand this tool - this is the same rule, like with any other technology outhere.
I can tell you that I'm using quite advanced MS Access fronted to MySQL backend and I'm very satisfied (as a developer which is maintaining this application). My friends, the users are also satisfied as they feel very comfortable with the GUI (frontend), the speed (MySQL), they don't have any issues with records locking or database performance.
Moreover, it's important to read a lot about good practices and other people experiences. I would say that in many cases MS Access is a good solution. I know a lot of dedicated, custom made systems which started as an experiment in form of private MS Access database (MDB file) and then evolved to: splitted MS Access (MDE - frontend, MDB - backend) and finally to: MS Access frontend (MDE) and "serious" database backend (mainly MS SQL Server and MySQL). It's also important that you can always use your MS Access solution as a working prototype - you have ready to use backend in your database (MySQL - let's assume) and you can rewrite frontend to the technology of your choice (web solution? maybe desktop C# application - what you require!).
I hope I helped some of you considering the work with MS Access.
Regards,
Wawrzyn
http://dcserwis.pl
I had an application that worked likewise: an MS Access frontend to a MySQL backend. It was such a huge pain that I ended up writing a Win32 frontend instead. From the top of my head, I encountered the following problems:
Development of the ODBC link seems to have ceased long ago. There are various different versions floating around --- very confusing. The ODBC link doesn't support Unicode/UTF8, and I remember there were other issues with it as well (though some could be overcome by careful configuration).
You probably want to manually tweak your db schema to make it compatible with MS Access. I see you already found out about the needed surrogate keys (i.e., int primary keys) :-)
You should keep in mind that you may need to use pass-through queries to do more sophisticated SQL manipulations of the MySQL database.
Be careful with using lots of VBA, as that tends to corrupt your frontend file. Regularly compressing the database (using main menu, Tools | Database utilities | Compress and restore, or something like that --- I'm using the Dutch version) and making lots of backups is necessary.
Access tends to cause lots of network traffic. Like, really huge lots. I haven't been able to find a solution for that. Using a network monitor is recommended if you want to keep an eye on that!
Access insists on storing booleans as 0/-1. IMHO, 0/+1 makes more sense, and I believe it is the default way of doing things in MySQL as well. Not a huge problem, but if your checkboxes don't work, you should definitely check this.
One possible alternative would be to put the backend (with the data) on a shared drive. I remember this is well-documented, also in the help. You may want to have a look at some general advice on splitting into a frontend and a backend and code that automatically reconnects to the backend on startup; I can also send you some more sample code, or post it here.
Otherwise, you might also want to consider MS SQL. I don't have experience with that, but I presume it works together with MS Access much more nicely!
Gareth Simpson opined:
If it's only two users, then Access
should do just fine if you put the
.mdb on a shared drive.
Er, no. There is no multi-user Access application for which each user should not have a dedicated copy of the front end. That means each user should have an MDB on their workstation. Why? Because the objects in front ends do not share well (not nearly as well as Jet data tables, though there aren't any of those in this scenario using MySQL as the back end).
Gareth Simpson continued:
I believe the recommended max
concurrent users for Access is 5 but
on occasion I've pushed it past this
and never come unstuck.
No, this is completely incorrect. The theoretical limit for users of an MDB is 255. That's not realistic, of course, as once you reach about 20 users you have to program your Access app carefully to work well (though the things you need to do in an Access-to-Jet app are the same kinds of things you'd do to make any server database application efficient, e.g., retrieving the smallest usable data sets).
In this case, since each user should have an individual copy of the front-end MDB, the multi-user limits of Access/Jet are simply not relevant at all.
I know this doesn't answer your question directly, but it might be worth checking out the SQL Server 2005 migration tool for Access. I've never used the tool, but it might be worth using with SQL Server 2005 Express Edition to see if there are the same issues as you had with MySQL
Dont forget to put some type time/date stamp on each record. sometimes ms access will think "another user has changed or deleted the record" and will not allow you to make a change! I found this out the hard way.
In general, it depends :)
I haven't had a lot of problems when the application side has just been updating the data through the forms. You can get warnings/errors when the same row has been updated by more than one user; but Access seems to be constantly updating its live record sets all the time.
Problems can happen if Alice is already working with record 365, and the Bob updates it, and then Alice tries to update it with her changes. As I recall, Alice will get a cryptic error message. It would be easier for the users if you trap these errors and at least give them a friendlier error message.
I've had more problems when I was editing records in the VB code through RecordSets, especially when combined with editing the same data on forms. That's not necessarily a multi user problem; however, you have almost the same situation because you have one user with multiple connections to the same data.
If it's only two users, then Access should do just fine if you put the .mdb on a shared drive.
Have you tried it first rather than just assume it will be a problem.
I believe the recommended max concurrent users for Access is 5 but on occasion I've pushed it past this and never come unstuck.
On the other hand I did once use Access as the front end to MySQL in a single user environment (me). It was a singularly unpleasant experience, I can't imagine it would become nicer with two users.