GeeCON Prague 2014*
The moose likes Java in General and the fly likes Embedding MySQL Database in Java Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Embedding MySQL Database in Java Application" Watch "Embedding MySQL Database in Java Application" New topic
Author

Embedding MySQL Database in Java Application

siva kumar
Ranch Hand

Joined: May 02, 2004
Posts: 120
Hi Friends,

I am attempting to develop an application that is used to display data from a MySQL Database.

The application should be self contained; Some thing similar to JOSE

http://jose-chess.sourceforge.net/index_manual.html

I need to know the following

How to Create a embedded database ( How can I import data from regular MySQL DB to an embedded MySql DB)

How to start the DB from Java

How to read from the DB

How to stop the DB from Java


If anyone can provide any reference to above tasks; I would be very much grateful.

If there is any sample application for the above tasks it would be great

Thanks in Advance
Siva
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
MySQL is native code (I think C), which needs a proper installation - how are you going to embed that in Java?

There are very good embeddable databases available for Java, specifically Derby and HsqlDB.


Ping & DNS - my free Android networking tools app
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39053
    
  23
Agree with Ulf Dittmer. It is probably better design to have a separate database (MySQL will do nicely) and use a JDBC connection to it.
There is a section about databases in the Java Tutorial here. I don't think it covers MySQL however.
siva kumar
Ranch Hand

Joined: May 02, 2004
Posts: 120
Hi Friends,

Thanks for the reply.... I need to use a embedded DB

I couldn't migrate my current MySQL DB to embedded DB Like Derby or HSQL

IF you can provide any utility for automatic conversion that would be great.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
I couldn't migrate my current MySQL DB to embedded DB Like Derby or HSQL


Why not?
siva kumar
Ranch Hand

Joined: May 02, 2004
Posts: 120
Hi

I took the backup of my MySQL DB using the MysqlDump utility

I tried to import the DB Dump into HSQL but I am getting sql Syntax error


Is there any embedded Java DB that uses the same SQL flavor as mysql or if there is any utility that can migrate MySQL DB to HSQL DB
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

Try searching with Google for "embedded mysql java".

I found this, for example:
http://forums.mysql.com/read.php?58,65466,65466#msg-65466
http://jroller.com/page/mmatthews?entry=yes_it_really_is_this
[ May 11, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Embedding MySQL Database in Java Application