I created a Java application that accesses a MySQL database (made using MySQL Workbench). I want to create an installer for my application so that other users can use it on other computers, but I can't figure out how to do so.
I tried using Launch4j and Inno Setup Compiler, but when I tried to install the application on another computer it didn't access my database.
After a bit of research, I found out that I (maybe?) have to use a server for my database, but I couldn't figure out what and how to do that.
My questions are:
Do I have to use a server to make my application installable on other computers?
What is the easiest server to use for this task?
PS: I'm very new at programming so please be as explicit as you can :)
Related
I am currently working on a university project to set up a database and a java GUI for the company I work at.
My idea was to use JavaDB (JDK-integrated Derby) or MySQL as database engine and connect to a Java application that I code using DBMC.
Ideally, both the Database and GUI Java Application would simply be saved on the company's network drive in the same folder, without the need of a permanently running an SQL server or something like that.
So when a user started up the Java application, the database (server) would start up too and close when the Java Application is closed.
I was messing around with Derby Embedded, but found that it was fairly impractical, lacking a useful gui administration tool like MySQL or multi-user access (not the first priority) and accessing it via SQuirreL didn't succeed very well either.
Do you know a better solution to this?
Would it be possible to do this with MySQL for example?
I hope, I explained everything okay.
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.
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
I have written an application in Java and used MySQL as the database system. The user can insert or delete the rows in database tables. I have developed the application on Ubuntu 11.10 and it is working properly.
My question is how should I port this application to a Windows machine? Do I need to install MySQL server on that machine? If yes, how to pack all executables into a single .EXE. How do I make this application work on all platforms?
Java applications, unless you did some less ordinary things such as relying on line ending or did JNI, should generally work OOB in all the platforms java is supported. Test and fix the things that don't work.
MySQL installations are different per environment, and yes, you'd need the DB server on that environment too, if you plan to run it locally. Usually, you'd request the user to install MySQL and configure it to your application - I see a potential EULA/TOS issue with packaging MySQL binaries with your own application. If you'd do it anyway, you'd want to use an installer to create an install file for you that would include the files and perform steps that are needed.
Edit: see this thread for more convenient alternatives than using MySQL with your software and also for a note about the potential license agreement issue.
Recently I made an application in using Swing, AWT and JDBC that manages some database. I used PostgreSQL as the backend with JDBC drivers 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?
Any help would be appreciated.
Take a lesson from most commercial applications that have a database component. Usually they require that the database be installed/configured beforehand and provide db scripts for their supported vendors. There are a lot of reasons for this. Most of these are related to the fact that organization's like to manage their own databases. This is often because they have company restrictions regarding security, maintenance, etc. Also a single database process may be shared between many different programs(if you install two instances of your application do you want to have to two installations of the database?).
Most folks(especially network admins) wouldn't want an application that ran around installing rogue DMBS's on their machine.
I wouldn't spend a ton of time attempting to install the database during your install process. Why re-invent the wheel when the vendor has already created an installation process for you? Instead install the database ahead of time and focus your installer instead on running the necessary scripts such that your application can connect to it on the first start up. What it does means is having your installer have the necessary drivers, connection information, and credentials to communicate with the database to get it initialized. After the DB is initialized then you can have additional routines that configure your application install such that it points to the database you initialized during the install. Taking this approach will not only be easier, but it will allow your application to do more interesting things like connect to remote databases or skip database initialization all together and connect to an existing database.
Writing an installer that also manages DB installation is a project in and of itself. The big question is do you need to install PostgreSQL from scratch or will you tell the user to install it themselves first?
I have attempted to do something similar and what I eventually did was build an installer with NSIS that includes Postgres and a JRE in the install bundle along with my program. The installer copies everything to the user's install location and creates all the required config files.
The biggest issue I had was that I had a number of config options to present to the user that would have taken a lot of programming in NSIS. So, I modified the ANT build scripts I already had written to build the project. What NSIS does then is copy the JRE to a temp location and start a Java installer GUI I wrote instead that gathers up all the config info and launches ANT in the background.
If you don't have much to configure or what you need to configure doesn't have many options, then you can probably do everything in NSIS directly. But, keep in mind that you need to be security conscious too. How are you creating a new user to run Postgres? What about directory permissions for you install? Who can start and stop the DB, who can read the db files, etc?
Maybe you may try a pure java database, like hsql, or h2, or derby....