3

I want to make a java application with a rather small database. The pc on which I want to install this has nothing of database stuff on his pc (no wamp server, no oracle, nothing...). I'm rather new in this kind of stuff, and i don't know if it's already been asked but this is what i want to accomplish

Now I have a couple of questions:

  1. Is this doable?
  2. What should I use? Mysql, Oracle,...
  3. How can i do this?

I hope this is enough to get a decent answer.

5 Answers 5

2
  1. Yes, it is doable.
  2. For use with Java, I strongly recommend Apache Derby because
    • you have the huge flexibility of being able to choose between embedded and client-server db, with no code refactoring needed to change data access mode
    • over H2 or HSQLDB: according to my experience I've found Apache Derby
      • to be much more reliable/resilient (other embedded DBMSs tend to break more than derby when power fails)
      • to eat up less RAM
      • to have better performance on bigger deployments (lots of rows, lots of data [in microbenchmarks with little real-world data H2 and HSQLDB can actually score better]).
      • to be particularly fast with select queries in heavily multithreaded environments
    • over MySql and PostgreSql
      • it's actually faster, when you are not CPU/network -bound, because I've seen it perform better than them in many cases (especially with bigger DBs -- say 10GB) when it comes to filesystem access (MySql and PostgreSql, however, are more efficient in terms of CPU/network utilization, when these are a constraint)
    • over MySql, PostgreSql, Oracle db, etc.
      • it's surprisingly fast (often faster), with very big DBs (say, 30 GB) -- something one wouldn't expect from a DBMS you can embed in any application with no deployment/configuration
  3. To get started, see

If you don't need clients from the network to remotely connect to your database, an "embedded database" is what you want to implement.


Flame-preventing disclaimer: all the statements above are according to my very own personal experience, with the projects I've worked on and/or articles/benchmarks that I read and trusted as reliable. Unless otherwise stated (and in fact I'm not stating otherwise anywhere :) ), I'm referring to fresh out-of-the-box un-fine-tuned installations.

Sign up to request clarification or add additional context in comments.

5 Comments

what should I choose from the downloads?
I checked this, but they say I have to install derby. but when I want to install this on someone else his pc, i don't want to install my application AND a database, I want to do this in one installation
You don't need to install Derby on a machine: you use the derby.jar as a library to your application. It will come wrapped inside the jar you distribute (yes, "it will be delivered automatically with the project", as you asked in that other comment).
just one question, How can I make a databse then?
Normally you create your database from your Java source code, via SQL CREATE TABLE statements. You can also use a graphical tool such as SquirrelSQL in order to access the DB (e.g. for testing/inspection purposes).
1

You should probably use an embedded database like H2 or HSQLDB. They are just a simple libraries that you drop in your application, but they provide exactly the same JDBC interface.

You can use the full power of SQL database without any external dependencies. H2, my personal favourite, allows you to create in-memory as well as persistent databases, you can optionally connect to it using socket, it can expose web interface over default 8082 port, so on and so on. On my developer machine I don't even have "normal" database installed, I always use H2.

2 Comments

So when I use H2, i don't have to install this on the pc, it will be delivered automatically with the project?
@user999379: Yes, it is a JAR, just like any other library.
1

I recommend using Derby database. It is very simple to embed in java application.

Comments

0

HSQL or use one of the SQLite JDBC adapters.

Comments

0

How is this computer's hardware? What CPU memory and hard-disk?

What is the OS? Do you have the administrator/root access?

If you have a typical PC with windows OS, and enough CPU, memory and hard-disk.

I recommend you to install mysql. Just download the mysql for your OS and install it.

Download link:

http://www.mysql.com/downloads/mysql/

Here is install documents:

http://dev.mysql.com/doc/refman/5.5/en/installing.html

Good luck.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.