I'm creating a simple CMS software which doesn't have much data to be stored. I'm currently using mysql as my data provider and have a java application in the presentation layer. This CMS will be a standalone which means datacollection and processing will be done in a single computer.
I created a installer to install in my clients computers. But I need to setup mysql then the database as well. And my clients doesn't have sufficient IT knowledge to setup the databases themselves. So for each client I have to attend and install mysql server.
What I need is a way to integrate data-provider to the application without using mysql or any other sql or nosql server. So my clients can install it themselves using simple guided steps in installation wizards.
You can use one of embedded db, like JavaDB (ex. Derby). Support of this database is added to JRE. So all your client need is installed JRE. And you get full relational database without any installation and other stuff setup.
You can try using hsqldb or sqlite db. These dbs can be bundled with the application in memory or can use a simple file as db. Hope it helps
I found a good example here
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javadb/
thanks every one for help
Related
I am making a web application in Java. I want to continue to develop this application even when i dont have administrative privileges on my work laptop. I am unable to install databases on my local system. Are there any free online databases i can use. I want to be able to provide a connection URL and perform transactions like in a local db.
I also want to try and connect to as many different databases as possible to test out my code.
Would in memory dbs need installation? Could there be a work arround there?
Thanks in advance.
You could use a JDBC wrapper for Sqlite.
Check out Sqlite-JDBC, or this list.
No installation needed.
For online database hosting:
MongoLab. Free for a 500mb shared database.
Compose.io offers MongoDb, ProstgreSQL, RethinkDb and more. 30 day trial.
Lots of options for MySql, eg. http://www.freemysqlhosting.net/.
Many more, Google will help you.
I Hope my answer helps you.
Instead of free-ish online databases I would also recommend to mount your own local home server, install the databases you want to try there and then publish your server to the internet either checking its public IP everytime before you leave to work or using a service like Hamachi for a local VPN or no-ip to have a domain so you can connect to these databases from work.
You can download and install some common free databases like:
MySQL Community Edition
Postgres
Oracle XE
SQLite
I'm creating a java desktop application using swing which requires some database persistance for which I'm planning to use Hibernate. I'm pretty new to desktop application development so I wanted to know if and how the database can be created on the client computer when installed.
Is there a script to be run or maybe a hibernate configuration which initiates database creation?
A sample tutorial or example illustrating this will be ideal (although I was not able to find one).
Thanks in advance for any help provided.
Hibernate is not an database server itself, it is a object-relational mapping framework so you need a either embedded or stanalone database server. Java DB that comes with the JDK will be sufficent for desktop applications.
http://hamidseta.blogspot.in/2008/05/install-mysql-server-50-silently.html
In your package installer scripts perform the steps of silent MySql installation. In the BAT file put the code you find in the above link before triggering your Java application installer.
As per free licensing terms, one should not package MySql bundle for free, just check about the licensing if you bother.
I think it would be better if you can start with javaDB or SQLite.
They are perferred embedded database technologies for desktop java applications.
You can download the jar for sqlite-jdbc from here.
Take a look at few tutorials on JDBC
If you making swing applications, make sure you learn to use swing worker well. It will
be important to perform background processing.
Hibernate is Framework used as middle layer in project which interact between database and Business layer logic.
Hibernate features
J2EE integration
Object/Relational mapping
Automatic primary key generation
Object-oriented query language
So my suggestion is to go with MySQL because
Handles large databases. We use MySQL Server with databases that contain 50 million records. We also know of users who use MySQL Server with 60,000 tables and about 5,000,000,000 rows.
A very fast thread-based memory allocation system.
Very fast joins using an optimized one-sweep multi-join.
The server can provide error messages to clients in many languages.
This is only few features but you go to official site for more detail. And most important it's open source.
And the post help to install and configure on client system.
I am working on project in java where I need to have both app as well as Database to be on USB .
I am thinking of either:
1) Installing MySQL on USB. But then I don't know how I would connect to my database that way. I also don't know how I would transfer the project from my development environment to client environment.
OR
2) Using embedded database like derby. I would package my app in jar and give it to the client. He could then keep it on USB and run it from their. In this case where would the database be stored? Will it be stored in the jar file? And if so how do I update my database in these scenario? Can I use ij tool from derby?
I am relatively new to derby.
For a great introduction to Derby and its features, follow this series of tutorials: http://db.apache.org/derby/docs/10.9/getstart/cgstutorialintro.html
I am making a Java desktop application which involves lot of data, state, etc.
I must store all this data in a DB for querying purposes.
Now if I distribute my application I will have to distribute the DB packaged along with the
application itself.
Which is the best open source "Packagable" DB which I can use for this purpose.?
(assuming say my application is for commercial purpose)
I don't want the end-users of my application to install a DB like MySQL seperately
I want it to be part of my application .msi(or zipped) installer, at the sametime it should not be too large (>50MB) and it should not require the user to take any additional steps for installation.
There is no best, but suitable. Try sqlite, its relatively fast, simple db library. Free
I can't recommend a best database, but I like using the Derby DB (or Java DB which is Oracle's Derby distribution).
i am not clear about steps/configuration details about how i can embed mysql in a Java desktop application so that it(application) can be installed on any machine through a single executable file and doing so sets up database and also provides an exe to run the app.Till now i have built my app using netbeans and i have used mysql to set up database.plz guide me further.
MySQL isn't an embedded database - the only JAR related to it is the JDBC driver. It requires a installation process, which might be able to be scripted via Java, but the process will definitely function outside of the Java application you intend it to support. Meaning, you can turn off your Java application but the MySQL service/daemon will still be running.
Only the libmysqld is embeddable.
There are embedded databases - SQLite, Firebird - and embedded databases made in Java - HSQL, Derby/(can't remember what it was called before). I believe SQL Server Compact Edition is embeddable, while SQL Server Express/MSDE is not. I don't know if Oracle has an embeddable version....
I would strongly recommend H2. It is a very fast embedded database written in Java and I've found it easier to use than some of the others mentioned such as HSQL.
Edit:
On the H2 website, you can see a speed comparison of H2 vs Derby, HSQL, MySql, etc...
Here's information on how to backup the database.
While theoritcaly possable it would not be easy. The standard MySql distributions assume you want to set up a general purpose database server with separate from the client applications cominicating via odbc etc.
You may be better looking at the "pure java" options like HSQL or JavaDB which are designed to be embedded in a java application, and need little or no "setup".
Another possibility is Sqlite which only needs a single binary plus the sqljbbc jar file. This is again designed from scratch to be embedded inside an application and requires zero admin apart from allocating a file for the database.
Take a look at http://dev.mysql.com/doc/refman/5.0/en/connector-mxj.html. I do not remember the exact details but I was able to embed MySQL db in desktop application without user needing to install it separately.
The key class is com.mysql.management.MysqldResource.
Here is the example, http://dev.mysql.com/doc/refman/5.0/en/connector-mxj-configuration-java-object.html
The mysql-connector-mxj-gpl-db-files.jar file contains MySQL installation files for all the platforms. If you know which is your target platform, you can strip other platform versions from jar, to reduce download size for end user.
If you want an embedded database with java, then use one written in Java designed to be embedded. I know Apache Derby Can be embedded and apparently H2 too.
How big amount of data dó you need the database to handle?