How to install a java application with a Mysql database?

Asked

Viewed 577 times

3

I am developing a java desktop application, with java swing and Mysql database. But I need to install this application on several machines and I would like to know an easier way to do this, without having to install Mysql on all machines.

You can install an application using Mysql and not install it on each machine?

I did some research on various forums and suggested the following databases: HSQLDB, Sqlite, Derby, H2 and Firebird.

There is the possibility of hosting the database on some server on the internet.

I would like to know how best to solve this problem.

  • 1

    "All forums I have read mention that it is not possible to install an application using mysql and not to install it on each machine." - That is a gross lie and without any foundation. What forums are these after all?

  • I searched in guj, some from here, among others. But is it possible to do this installation ? I will look for the link and put here.

  • @Victorstafusa if it is bank standalone it’s not enough to lie.

  • If you want to ship the database together with the application, where each machine will have its own instance, it is not possible to use mysql, because it is based on server. Now if you want to make a database only shared among several machines running your application, it is an option, but as I said, you will need a machine to be the server.

  • diegofm would be the first option you really said, embark along with the application. Which bank can you suggest me ? Thank you for the reply.

1 answer

4

Let’s assume that you have published your Mysql server on the host bd.example.com, on the standard Mysql port (3306) and that the user is fulano, the password is senha123 and the database is called minhabase.

In this case, you get a java.sql.Connection while doing so:

String url = "jdbc:mysql://bd.example.com:3306/minhabase";
Connection conn = DriverManager.getConnection(url, "fulano", "senha123");

Also, you should obviously have the Mysql JAR in classpath. See more about this in my other answer.

  • The mysql jar I already generated using Maven, this part is already working. But got it, I would change the connection string and host the database. Do you have a website for database hosting to suggest ? Thank you.

  • @Jessica Hosting database, I don’t know. I haven’t been after it for years, because I usually host what I need with my own resources. Meanwhile, there are hundreds of companies out there that sell Mysql hosting.

  • @Jessica, subscribe to Kinghost...there is simple to use and cheap...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.