how to bundle Java application and Oracle database - java

I created one small application in java. And I used Oracle as database. Now I want to create one exe file so that I can transfer my application to other pc. But I am unable to understand how to add database files to my application. I am able to create executable jar file, but it doesn't have the database structure and Oracle installation is required to use my application. Is there any platform required to install, to work with Oracle database without actual Oracle installation as like jre for java? And how I bundle the application and database together?

Try using something else for local storage like JAVADB also here
or maybe sqlLite

Related

How to create an exe file for a Java application which uses Mysql

I have developed a desktop application in java using netbeans and Mysql as my DB.
How can I create an .exe file including the database so that it that my application could be executed on other device?
Starting with MadProgrammer's quote:
AFAIK MySQL is database server, meaning it doesn't operate in
standalone mode. This would mean that you would need to install MySQL
on your target machine - which kind of seems counterintuitive. If you
want a standalone database, then maybe h2 would be a better
alternative, it's a pure Java SQL database system, which doesn't
require any additional installation
The simplest option is to use an internal DB, so that every resources will be bundled into a single application.
Otherwise - How can handle the external DB related issue (it being an application running alongside your java application)?
By creating a dedicated installation flow (running dedicated scripts which will install required 3rd party solutions prior to allowing your application to be executed):
Install the DB of your choice.
Optionally allow initial configurations to be aplied to the DB.
Install your own application.
Finalize the binding between the DB and your application.
Configure the OS to optionally run the installed DB on startup.
As for having an .exe executable for your java application - see the references I have provided. A 3rd party tool should easily create a .exe that will suite your needs.
A batch file which encapsulates the java -jar ... command can also work.
References:
Convert Java to EXE
How do I create an .exe for a Java Program?

How to pack Java Desktop Application made using eclipse with MySQL database with all the Data?

I have made a JAVA Desktop Application using Eclipse and MySQL as a database. I want to use the application in another PC with all my created schema and data. How can I bundle or make an installation file so that it installs mysql with the required schema and the JAR file of my application into another pc?
Note: I know we can use embedded Database like H2, Sqlite but I want it to be done using MySQL only. So no suggestions on using other database for my application.
Not sure how your application architecture but below point or solution could help you.
Solution 1 :
You can create DDL for schema database and the insert data. Once your application successfully install, you just run the script to execute this DDL file. Can be done in automation installation script.
Solution 2 :
You can dump mysql and restore to other PC. No worry about the structure, it completely clone from the original including data. Can be done in automation installation script. Dump mysqlDB link
Solution 3 (not recommended):
You can copy entire mysql data in directory and paste to other machine mysql directory. Based on my experience, never success. But look at this guy link
There is a pro and cons using embedded SQL or centralize SQL. If you stick with this kind of architecture, you should consider use embedded SQL like you mention.

How to embedded and make protable database for a java standalone apploication?

I am working in a java stand alone application which connect with a database(later i'll explain which database).
Now after generate the jar file,its working fine in my system where i create the application.
but when i want to run that jar file in another system,its running correctly but in the login part (where the database terms coming),when i click on a button which will open the login window it passes an exception,-- "java.lang.ClassNotFoundException.org.h2.Driver"(i'm using h2 database).
But there's no such problem in that system where i create that application.
Firstly i used MySQL database..but i search in the internet that MySQL is not portable database. so i switch to H2 database which is an embedded database.
i did same whatever they said to embedded h2 database. But still i got the same problem..
My database is still not portable.
I want that whenever i generate the jar file,the database which has all the data of my application is bound with the jar file.and same for creating .exe file...that is when i take the .jar or .exe file to another system and want to run it there,the database should go along with my jar or exe file.
i have seen this websites,but unable to get the solutions..
Finished Java project, now creating jar or .exe file (with Database)
How to Bind MySql Database inside a JAR file of any application?
please help.i need your help badly.
Java DB or Derby could be good choice. It is already embedded into Java and so it always exist. It is also pretty simple and powerful.

how Derby database works?

Wikipedia states that derby database can be embedded in a java application. Does it mean that we do not need to install a database server separately as if we were using Mysql for the same application?
Does it mean that we can simply ship a jar file with the database embedded in it, and not worry about installing a database server separately?
Yes you are right, Derby is a database internally supported by Java. This database can be of particular use when creating desktop applications or creating applications in which we do not want to install a database server on target machine.
Derby libraries can directly read database files that are held in JAR archives, so no need to install Database servers for this. Derby has all of the features that you would expect from a modern SQL database.

database attachement when creating .jar file

I have created a desktop application of shop management system and it is working well (runs on ide) but when I created a jar file of it and run this on another computer then it is not doing anything.
The problem which I figure it out is that the database is not attached with the .jar file.
Can anybody guide me?
Details:
Language : java
IDE: netbeans
Database: mysql server 5.1
First of all Mysql server doesn't support db Embedding feature.
You may consider changing the DBMS If you want to ship your database with the application.
apache derby
h2
and sun's distribution of JavaDB
These will help your current scenario or if you have simple light weight operations, You can use SQLite.

Categories