tags:

views:

56

answers:

5

I am practicing writing an app which use MySQL to manipulating data. My concern is if my client machine doesn't have have MySQL pre-installed, it's not be able to run my app, is it?. So is there anyway to embed the database server right into the app, or to run the app without the data server. I wonder how all the softwares out there manipulates data. It's not like we need to install some kind of database server before install the app.

+4  A: 

MySQL is a client/server database engine, which means that you must install the client and server separately from each, and they communicate over some kind of network protocol.

If you want to deploy a stand-alone application, you are probably better off using a library like SQLite, which gives you as much of the functionality of a SQL database as you are likely to need in such an app, but instead operates on local files and doesn't require installation of a separate server.

Marcelo Cantos
Usually what is required from the client side is some data access protocol (ODBC, JDBC, ADO .NET etc) API which is provided by the programming language used.
Ranhiru Cooray
Thanks. SQLite is exactly what i'm looking for.
NC7
@Kel, if you want to offer a completely different solution, then you should provide it as an answer, not as a comment on another answer.
Marcelo Cantos
@Ranhiru: This isn't required for SQLite. It has its own C API with many different third-party bindings to other languages.
Marcelo Cantos
@Marcelo Cantos: thanks, formed comment as separate answer.
Kel
SQLite is perfect for this, and another big plus point for it over MySQL Embedded is that it's free. To use MySQL Embedded in the way you're talking about, you'd have to pay a license fee for each and every copy of your app that you ship. I don't know how much that is nowadays, though the fact that the MySQL website doesn't disclose pricing information is not a good sign!
miket2e
A: 

Hello,

Your application could work with the remote database, when configuring database connection you should set your DB server IP address(host), port and login credentials. so in order to write application which is dealing with data manipulation, you need to connect to any database instant.

danny.lesnik
+2  A: 

You can embed MySQL in your application, see MySQL as an Embedded Database for details.

joschi
A: 

I suggest to wrap db layer in you application witch simple interface provided for all operations performed on the database. In this way, you will not have to go into the details of the atomic operations on the database and through unified interface, you can create several different classes which will be responsible for access to different databases in the same way (the same interface). These classes should realize the interface and implement all necessary methods inside (for example ADO). Now your db layer can be visible in all program it the same way. Wrapped class can realize singleton desing pattern and can be used as one instance enywhere in your application. Universal class design (interface) gives you many benefits such as the possibility of substitution on another layer if necessary (switch to a totally different db).

UGEEN
So many computer sciencey words, so little useful answer.
ceejayoz
so many useless comments and no useful answer
UGEEN
A: 

If you are working on client-server application, MySQL database may be accessed either by means of MySQL (this solution may be suitable for internal networks), or through some database-side service, which can provide some API and which can be accessed from client via some application-level protocol (for example, XML-RPC).

If you are working on client application, there are other database solution, which can be used in stand-alone software: SQLite, Derby. As an alternative to database approach, you may consider storing data in XML / YAML format.

Kel