aspose file tools*
The moose likes JDBC and the fly likes Using Excel as DataBase, creating tables inside .xls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using Excel as DataBase, creating tables inside .xls" Watch "Using Excel as DataBase, creating tables inside .xls" New topic
Author

Using Excel as DataBase, creating tables inside .xls

Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 63

Hi.
I have decided to use excel as my DB. Now consider one excel file with many sheets inside as my DB.
Can i make a sheet(the tabs along the bottom) inside the excel file as one table and can access them using their names?

Now with my .xls file as my DB, is it necessary for me to have MS Excel product installed when the JAVA application is accessing it through sql queries?
I think the second question is very silly but i want to be very confident of myself before i start.

Thanks.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Excel is not a DB. Do yourself a favor and don't try to use it as such; tears lie down this path.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Tim Moores wrote:Excel is not a DB. Do yourself a favor and don't try to use it as such; tears lie down this path.

You would need a synchronized acess to the file. I agree with "Tim Moores", do not do it!

If you ca not install a DB for your project you can use Derby or HSQLDB.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 63

I came to this idea only after glancing few codes(which i never tried out) in few websites including Ranch.
Those codes actually make a jdbc connectivity using JDBC-ODBC bridge to an excel file and also play around on the resultset by queriying an excel file.
Now can i use Access instead? or Derby is still more optimal than access?

I dont want to go for an enterprise level DB. but just want a minimal DB instead of hardcoding stuffs into my code.

I work on Eclipse and i can use database explorer in it and create tables using that UI. But out of the eclipse how will i ship the DB along with the JAVA application standalone? I just want to say- "this file is your DataBase, This JAR file is the application, put them together in a directory and run it, Enjoy". While working in Eclipse i often fear this.. how will my application configured in the outside world? Eclipse does everything for me and i miss out on these little knowledge that i should know.

Thanks.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
HSQLDB and Derby are Java DBs that you can embed into your code. They store their data in files that you can ship with your application. If you're just starting out, check out HSQLDB.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using Excel as DataBase, creating tables inside .xls