I wish to distribute my restaurant application, which uses MySQL to store the data. I plan to use Lauch4j to distribute its .exe file.
But the program also requires the user to have mysql Installed, is it possible to hard code mysql setup within the application? or anything else that could be done to avoid the user the pain of downloading and installing it?
It is a matter of opinion, but I advise you to not do it.
If your main concern is the install process being easy for the user, use some embedded DB. That way, the user not only will not have to care about things like firewalls, possible mysql vulnerabilities and so on.
If you need something that only mysql or other standalone DBs can provide you, don't hide it from the user. Technical capable users should be allowed to configure your app to run in the sql engines they already have installed (if they want to). Other people should at least know that you are installing something else apart of your app. Of course less tech-savy users will be scared, but if they do not know what they are doing they should not be tinkering with MySQL (or even installing programs).
In essence: Let the people know what you are installing in their systems. Allow them to reuse other DB engines if they chose to.
If i was you, if MySQL was the option, I would just take it for granted that it is installed and ask for the connection parameters (make it the first step of the installation procedure so you can check it before proceeding).
You can use SQLite in for your application. If any application needs to store data in the same system only and the application needs to be small and lightweight application then you can use sqlite as database. SQLite makes a great application file format.
Related
I'm making a voting app in Java using Eclipse where the user votes for their favorite team. Right now I have a local MySQLite database that I am managing with the MySQLite Firefox extension. The votes are stored in the MySQLite database, then I have another java application that reads from the database and outputs the name of the team that got more votes. However, I would like to store this database online, so multiple people can vote at once, then the results are displayed. How can I go about doing this? I am guessing that I will need PHP, but I am having a hard time finding a tutorial on how to integrate a MySQLite database with PHP. I pretty much just need to store my database online. Everything is functional locally.
Maybe I'll need more details but I'm assuming you have wrote a Standalone Java app, which is connected to you local SQLite Database.
Also, I think you don't want to distribute that app for everyone who wants to vote (would be better if they could vote via a website, right?).
In this case, you have to write a web application to provide both front-end and back-end of your app. You can pick one among many existing languages and frameworks (PHP is one of them), such as Java itself with some web framework, Ruby on Rails or Python/Django (just to depict some of them). Plus, I'd recommend you to use some other database such as MySQL or PostgreSQL.
Here are basic tutorials to you follow for some of the previously mentioned languages/framework:
Java (JSP)
PHP
Ruby on Rails
To deploy you app (i.e. put it online, you'll need a server). Honestly I'd recommend you to use Heroku because the deploy process is really simple (just push your code using git) and you can run your app for free (if your app got really successful you may have to scale up the server and then you'll have to pay, but maybe that's not the case, right?).
So, pick up a language and framework, write your web app and deploy it to the server. Then you can have multiple access voting into the same database.
I'd like to ask for your opinion on local databases for a java application i'm developing.
Its veterinary application, meaning I'll need to store Customer, Pet and Medical History details for a start. I know how to use JDBC but I've only used it online in applets.
So, I really dont know much about local solutions and how those gonna work when I'll publish the application in a .jar, so please guide me. Would MySQL still work?
Thanks!
This is fairly general question and light on details and MySQL sounds like it would work here. If this is for local-only access and a typical client-server model is not needed then I'd encourage looking into a database engine that can be loaded directly in the JVM. One of the benefits is that there is no need to install any separate database components and the JARs for the entire database engine can be packaged in your application.
Below are a few of these:
Apache Derby
HyperSQL
H2
SQLite - Some Java wrappers around the C library are available but there are not any pure Java JDBC drivers available for this that I am aware of.
I realize that it is not difficult for developers to configure MySQL for local use but it could lead to a number of support issues for end users. It may be possible to script the installation to preconfigure a large amount of it but I am not sure of the details of that and it would be an additional item for you to work out when packaging the application.
Some general questions about utilizing MySQL for this are shown below. It may very well be the best way to go but these are just some things to consider. Most of these are not really specific to the development of the application and are more on the support side of things. Utilizing a database engine noted above can eliminate all or many of these.
Will multiple computers every have to connect simultaneously to the same database?
What MySQL password do you use?
Do you recommend that end users all use the same one which may not be good security?
Or do the end users need to create one in which case you may need to deal with forgotten passwords and the end user having to configure the password in your application?
Do your end users run antivirus software that may interfere with the database connection?
What if they have another program that uses MySQL that is already using the default port?
I recently made an interesting application using Play Framework and MySQL Connector/MXJ to make a completely portable web server with database, independent of any currently installed software(including Java).
I'm still new to MXJ, and the desktop application realm (as opposed to straight-up webapps), so I'm wondering if there are other, better methods for storing/accessing large amounts of data than embedded MySQL. I would assume so, since it seems not many people use MXJ. It essentially just packs mysqld.exe in its various forms for multiple operating systems and platforms. It runs in its own thread, and stores its data in whatever directory you provide.
For an application that frequently analyzes and searches through data in large chunks(100MB to 5GB), what other (fast)options are there, or am I justified in my webapp-laziness of bringing along MySQL?
Independent of any currently installed software(including Java).
If you are looking for an embedded database for a desktop application, then you can go for SQLITE. However, there are pros/cons for using either MySQL or SQLite
SQLite:
Easier to setup
Great for temporary (testing databases)
Great for rapid development
Great for embedding in an application
Doesn't have user management
Doesn't have many performance features
Doesn't scale well.
MySQL:
Far more difficult/complex to set up
Better options for performance tuning
Fit for a production database
Can scale well if tuned properly
Can manage users, permissions, etc.
You can find more info on when to use SQLite here
UPDATE: I came across HSQLDB and here are its test results. HamsterDb is another option.
Do you really need a database if your app is single user and desktop based? Maybe it is faster to simply write large files to the local filesystem then loading then through the network tier. If your app is very complex you could use an embedded db just for storing your domain and configuration, but if its not maybe you can avoid using a db + sql + o/r-mapping and so on.
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....
I have a project this year. It is about developing a Java application with a database for sharing and validating documents between the manager, secretary and head of finance.
My question is: How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Is there a possibility (or technology in Java) to put the database on the web and there will be accessible by all, or make it accessible from a computer that I realize as a server (client-server).
I would be grateful for your help or giving links for Tutorials.
How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Your question suggests that you will need one database on one computer. Let's call it a DB computer. I'd suggest this be a server, that no one from regular staff, such as secretary, manager, etc... can access.
Having one central database will eliminate your worries about integrity violation.
Now, you have two options. You can make a web application that your users will use to interact with your system. This is a more modern approach, since you'll have a 3 tier system:
users will access your application via a browser
the web application itself is stored on an application server, and it is accessing the database
the database is the backend part
The second option is making a desktop application and deploying it to everybody's computer that will use it; and afterwards making it connect to the database for interacting with it.
The first option is easier when you want to expose your application to a large number of users (and to the web), but know what you're doing when doing stuff like this, since you have to take security very seriously.
If you go the first route, you will need a few things:
First, a database. Use what you can, but if you need free and high quality databases, use PostgreSQL or MySQL.
Second, an application server. I suggest using Tomcat or GlassFish.
Now, you need to develop your application using JavaEE. There is a wealth of information about this, so I hope this will help you in the beginning and point you in the right direction.
Note that Tomcat doesn't support Java EE fully, but a subset of it. And this subset is surely more than enough for what you need to accomplish.
If I understand you correctly, you are looking for ways to implement a client-server system, where several clients on distinct computers each connect to a central server (or cluster of servers) hosting a DB. In Java, usually (but not necessarily) the DB is inside a web application, and the clients are lightweight web clients - in this case it is usually called an enterprise application.
Java has a whole dedicated SDK for this, called Java Enterprise Edition. You may find many questions dealing with this on SO, here are a few which I think may be especially helpful:
Is the offical Sun Java EE tutorial the best way to learn how to make Java web apps?
What to learn for making Java web applications in Java EE 6?