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.
Related
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.
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
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.
I have prepared an application that is a small demo of Student information manipulation. I have stored information related to students in a MySQL DB. Now my application is working 100% on my computer. But I want that work everywhere without depending on Database! I mean I just want "WHEREVER MY .JAR FILE GOES, DATABASE SHOULD ALSO GO ALONG WITH THAT INSIDE .JAR FILE "
So anyone who is using my application or trying it, they can realize exact result of this application.
How can I make this possible? Please someone help me.
For that I have done the following things:
I have installed MySQL database on my computer.
I have created a database on that MySQL server
I have created some tables in the database with a lots of data.. this data is to be used in my whole application, even for login.
Now I want to deliver this application to various clients but my clients are not technical persons and I don't want to give instructions to each of my client to do the above four steps.
How can I integrate some functionality into my app so that they can use my database, Tables and Data automatically .
It would be much better if the code can install the MySQL database automatically from the setup file attached with the application.
How the applications available in the market manage information
Have you thought of using another database engine?
MySQL requires the server to be installed and configured, and it is a huge task to be done by an automatic installer.
What about using for example SQLite http://www.sqlite.org/ or Apache Derby http://db.apache.org/derby/. Both of them work by creating a file in your working dir, you could setup the database and populate data at install time
I have two suggestions for you:
A. Use SQLite instead of MySQL. SQLite is an embeddable database engine and does exactly what you need. You can simply copy the .sqlite file where all the information is stored and distribute it with your JAR file. Given that you've already written you app to use MySQL, this could mean making a few changes to your code.
There is a good SQLite jdbc driver at:
https://bitbucket.org/xerial/sqlite-jdbc
I've used it before, though not extensively.
B. Use a portable installation of MySQL. If you are using Windows these are available on the MYSQL page, look for the downloads marked "ZIP Archive" instead of "MSI Installer". These versions are portable in that they do not require an installation process, just unzip the file, and start the service. Your clients need to know how to start it up, of course. Perhaps you could create a shortcut for that.
Of course, the idea of MySQL being a network server is so that everyone in the enterprise works with the same data, by connecting to the same server. If your clients will use this application in various computers in the same company, you should consider having a single MySQL Server installed, and making the clients connect to that.
Hope this helps!
Is it possible to have a embedded database in a small web application? What I need is there should not be any need to install any database in the server machine. By just adding a jar in the folder the database should work.
I am using Java EE, and Netbeans as my IDE. If its possible, what are the open source databases that can be embedded.
Any pointers to some good tutorials will be more helpfull.
HSQLDB, a popular embedded database, is just one jar file that you can drop in your application.
SQLite is the big one. MySQL has an embedded server, but you need to purchase a commercial license for it. Firebird also has an embedded server which it's free.
I haven't tried that but thinking about it, I think you can. I have worked with HSQLDB before and all I had to do was to run the embedded db and then run my client. You can do this by creating a cmd script in Windows or .sh script in Linux.
Some embedded databases:
H2
HSQLDB
Java DB