Java based Standalone application - java

I am developing a standalone application for a client using Java Swing and jdbc with MySQL. I am using MySQL as the database.I want to know that how the client can install MySQL, is there a way by which the client can install MySQL in his machine,or can i distribute the MySQL setup.The client just needs the software running and do not want to go to any installation process.
What is the way around with that??

Use Java Web Start to launch the app.
The MySQL installer can be invoked from an installer-desc element in the launch file. Here is my demo. of the JNLP API ExtensionInstallerService.

You're likely to find H2, HSQLDB, Derby, or SQLite to be more suitable for your deployment. They're intended to be embedded in other applications.

This might not be the simplest solution, but it is a good idea to have an installer for your application, which would take care of MySQL installation. IzPack is a very reasonable installation tool, which can execute external applications (e.g. MySQL installer) as part of the installation process. This discussion might be of some interest.
However, as mentioned in other replies, the use of an embedded RDBMS such as H2, SQLite etc., is a better choice than MySQL for a standalone application.

Few portable database alternatives: Derby, SQLite.

Related

my java application setup isn't working because of database [duplicate]

I created a java application that is a front end for a MySQL Database using NetBeans and JDBC.
Now after creating the jar file it runs smoothly on my computer (Since I have the MySQL installed) but, if I run the jar on a different computer it won't work since it does not have the DB the application is using and not even MySQL installed.
So the question is, is it possible to add the database to the executable jar so it will run on any computer without the need for any installation of any software (Except for JRE of course) ?
If yes, how do I go about doing so?
Thanks everyone for the help in advance.
Use derby database. It already included in JDK's db folder when you installed the Java on your computer.
If you purely want to use the database without using the MySql then simply using the collections to create database, then you doesn't need any other database client as like MySql. But you need knowledge of Hibernate, Spring etc.

Java local database

I am creating a piece of software using Java and Eclipse. The software is to be freestanding and not require an internet connection.
The main use of the program requires access to database. I am used to developing for Android where there is an inbuilt MySQL database in every device. Is there a similar thing with Java. I have looked everywhere and have seen references to this kind of thing but have not seen any clear answers. I know there is JDBC, but this seems to be a method of controlling the database rather than creating it.
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
The version of Java I am using is java.runtime.version=1.7.0_40-b43
and I am using Eclipse Kepler Service Release 2
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
First, Android includes SQLite (not mysql). Second, No. No there is not. You could use Derby or SQLite or H2 (or any other pure Java database). As pure Java databases they don't require external installation (but they can be installed externally) and can be run directly in Eclipse.
Would SQLite work for your purposes?
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
It's not pre-installed, but seems like it might be a good fit otherwise:
http://wiki.eclipse.org/Connecting_to_SQLite

Create .exe for java swing app with embedded HSQL

Recently I made an application in using Swing, HSQL Embedded that manages some database. I used HSQL as the backend to connect to the database. What I want to do is create a setup/installer program so that the application can be installed and used on any pc. My problem is I dont know how to integrate the database along?
You can use exe4j to generate .exe.
And wizard4j to create installer for your application.
Problem is that creation of exe is quite isolated case. In case of Windows, you will create msi package, in case of OSX, you will create dmg, in case of Linux, you will create rpm or tar.gz etc. Yes you could use exe4j, install4j etc. But I strongly recommend to put your jar in one specific folder, zip it and distribute in that format.
Now, when it comes to your database "integration", have a look at this question and this documentation. Reason for distributing Java application this way and not with installer come from bad experiences I encountered when writing data into flat file databases after applications get installed via install4j or exe4j.

How to connect automatically a java program to a MySQL database directly?

I want to use MySQL for my Java app, but is very important that the user hasn't to start or install any program before start the app, so, How can I install MySQL (If it's necessary) and start the MySQL server directly by code? Have I to use other database?
MySQL has released this presentation dealing with details on how to do it if needed. It lists these three options:
Embedded library
Silent windows install
Launch mysql form command line
Check the presentation for details (the .pdf in the .zip linked at the page).
Note that you have to be licence compliant also to do this. GPL for GPL, commercial for commercial.
You can use something like the Nullsoft Scriptable Install System (NSIS) to install MySQL on the user's computer, along with your Java application. Your Java application would have to create all of the tables needed by your Java application.
Your other alternative is to use a Java embedded database, like HSQLDB. Your user would just install your Java application.

Deployment of a Swing application that uses a database

I have created a Java Swing application with database in NetBeans IDE. I have a database created directly in NetBeans. How do I arrange that this application will be installed to run outside NetBeans IDE? For example in Windows. When I have applications without database, it is easy; but the database I do not know.
you need to install a database such as:
mysql, microsoft sql, sqlite, etc.
You can also get portable versions of these that only require an unzip and run (e.g. mysql in xampp).
You will need to create a script (either in your program or do it by hand) to create the necessary schema, and tables that are needed.
Your application must have the same credentials for both your database but also within your requests from java.
If your doing the installation by hand you usually do all the above by hand.
The database need not be on the same computer but can be on the same network or also on the internet - but it will have to be somewhere unless your using something portable like sqllite.
If your creating an automated install script you should define that in your question.

Categories