mishajw126
mishajw126

Reputation: 517

Using databases with Java on Mac

I need to create a simple Java application that connects to a local database file, and will run on a mac.

I've figured that JDBC is a good option, but what file format/drivers should I use? Is .MDB files a possibility?

Thanks for any help!

Upvotes: 0

Views: 964

Answers (3)

Gord Thompson
Gord Thompson

Reputation: 123689

Is .MDB files a possibility?

It could be, via a library like UCanAccess. However, using an Access database (.mdb or .accdb) would only be advisable if there was some other compelling reason to do so, e.g., to take a copy of the database file and use it with some other application that requires an Access database.

Otherwise, one of the suggestions from the other answers would probably be a better choice.

Upvotes: 0

Bruce Martin
Bruce Martin

Reputation: 10543

For a small DB I would suggest using a DB written in Java. The DB's below or all < 2mb. Keeping it in java means it is easy to transfer to Windows / Linux if need be.

Possible DB's include:

H2 - H2 has a mixed mode where the first time the DB is opened it is op Advantages:

  • Mixed Mode
  • Only a couple of Files
  • has built-in SQL

HSQLDB - Version HSQLDB 1.80 is the smallest jar of the three (by a big margin) The 2.* jars are similar in size to H2 Advantages:

  • Small size (Version 1.80)
  • Only a couple of Files

Apache Derby

All three offer Server and Embedded mode, H2 has mixed mode as well. All three are open source.

Upvotes: 2

Use Apache Derby embedded in your application. This keeps it simple while still using standard JDBC.

H

Upvotes: 0

Related Questions