views:

181

answers:

4

Can MySql database be used as a back-end of a desktop application. What are the various possible ways to do it?

A: 

Can MySql database be used as a back-end of a desktop application

Yes, of course - just like any other database.

What are the various possible ways to do it?

What do you mean? Do you mean how to access the database from the app? Lots of ways - some are:

  • via its native C API
  • via ODBC
  • via JDBC

Which one you use will of course depend greatly on which language(s) your desktop app is written in.

anon
+2  A: 

I would say that it would be possible, with each desktop application client connecting to a centralized mysql database, at the client site, or possibly connecting to a centralized server managed by you/your company, and like @Neil Butterworth mentioned there are various APIs/methods to use to talk to the database. However, if you are looking to embed a database with your application, I would suggest looking at sqlite instead. It is a small,lightweight relational database designed for being embedded into applications.

nstehr
+1  A: 

Yes, I have done so on more than one occasion. Build your database in MySQL, either locally or on a remote machine, and then set up your connection to the database using the appropriate API.

There is a package for connecting to a .NET application (just search .NET MySQL library and it should turn up), with Java you can use Hibernate (or any other ORM Framework) and set the dialect to whichever version of MySQL you're using in the hibernate.config file. Or you could just use ODBC/JDBC directly. I'm sure other languages have their own support.

Any application, if built well, should be able to be supported by a variety of databases, and it should not affect the application. Switching between databases should involve changing a couple of property files at most, and then testing for database-specific idiosyncrasies.

Elie