aspose file tools*
The moose likes JDBC and the fly likes Need To Store Data, But cannot have a database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Need To Store Data, But cannot have a database" Watch "Need To Store Data, But cannot have a database" New topic
Author

Need To Store Data, But cannot have a database

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

When we create an application for saving our contacts, we create tables in SQL database or whatever, and deal with the database via the java code. when we need to give the software to the end user, we have to set the drivers, create the tables and all in his side. But, I need to develop an application that where the we don't have to create all the databases, tables, in end users machine.

I have seem some contact details management software (written in c#), they store the data inside it self( might me it is using some kind of INBUILT database), WE DON'T HAVE TO CREATE ANY DATABASE to run it at all.

I don't know how to store data without the help of a database. May be JTable? (I have no idea about JTable), or any other system? I need to create a software like that, which not need us to go and create a database in client side, and the application is capable of handling the data it self. And yes, it should allow us to navigate through the data, search data, delete, update, insert, etc. Please help


Are you better than me? Then please show me my mistakes..
Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 147

"cannot have a database" is a bit odd ... how can you store data if you're not allowed to store data?

If you are saying you cannot use an RDBMS on the network, there are a lot of filesystem-based databases (derby, bdb), and it's not uncommon to use a CSV or XML file as a (non-SQL) database. For a single-access datastore, you have a lot of options that don't require the complexity of a full RDMBS system.

Another option - if your data is encapsulated in a Class, serialize your classes to a folder. If that sounds interesting, see java.beans.XMLEncoder and java.beans.XMLDecoder .


OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Daniel Val
Ranch Hand

Joined: Jan 09, 2012
Posts: 44
Yohan Weerasinghe wrote:Hi,

When we create an application for saving our contacts, we create tables in SQL database or whatever, and deal with the database via the java code. when we need to give the software to the end user, we have to set the drivers, create the tables and all in his side. But, I need to develop an application that where the we don't have to create all the databases, tables, in end users machine.


Still there are solutions where you can do that with a database server, except with an embedded one.

I used sqllite, not sure if it can be embedded in Java. HSQL can be embedded in Java. It might consume more memory, however this is very easy to impose these days on a client computer - few of them don't have at least 1 gig or 2.

Otherwise, your only approach would be to serialize your data in some folder and then load it from there.

D.
Patryk Sosinski
Greenhorn

Joined: Sep 10, 2011
Posts: 18
Daniel Val wrote:

Otherwise, your only approach would be to serialize your data in some folder and then load it from there.




Yep, or store data in XML file (easy import, export, transfer etc.).
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I second the recommendation for embedding HSQLDB.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

Daniel Val wrote:I used sqllite, not sure if it can be embedded in Java.

It can. There is a JDBC driver available for SQLite.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

Embedded apache derby might be another option you might want to consider.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Thanks a lot for all of you for the comments. I really appreciate it. I never thought this much of solutions available I am gonna choose "embed database" solution. But now the case is, you all have given number of databases, so I am having a problem about which one to select . I will walk through all the documentations of those embed databases, and will select one. Thanks a lot for all of you help. I Will be back with a good result
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need To Store Data, But cannot have a database