简体   繁体   中英

Free MySQL web host to connect java desktop application

I'm kind noob when in comes to database applications, here is the scenario,

I have developed a desktop application which needs to be connected to a MySQl database remotely. So my problem is where can I get a free server to host my database and what are the specific configurations I have to make in order to successfully connect to the database from any machine with a internet connection. I currently use a local db(H2) for the application.

Connecting to a database residing on a remote machine is not different from connecting to database on a local machine.

When you use a driver MySQL Connector/J - JDBC Type 4 driver , then you specify the address of the machine where the database is hosted like :

String connectionString="jdbc:mysql://172.27.60.84:3306/"+dbName;

This is for the remote machine and is the syntax for local machine:

String connectionString="jdbc:mysql://localhost:3306/"+dbName;

Or

String connectionString="jdbc:mysql://127.0.0.1:3306/"+dbName;

I think that the mysql will be internal and you will only be able to get at it through the website on thier server or the provided phpmyadmin or simular.

You would be best renting a VPS. I rent one from HostMedia and thats fine for a webserver and mysql server. (you will need to install apache2 php mysql yourself)

You can get free databases from platforms like Heroku or OpenShift (both PostgreSQL rather than MySQL, but that's a good thing), as part of the free tier of their hosting plans.

However, i doubt you can access the databases directly from remote machines. They're there to support web applications also running on those platforms, not remote applications. You would need to write a web application to act as a proxy of sorts, and provide access to the databases.

The normal way to do this would not be to simply write a proxy that passes on database requests, but to migrate some of your application logic to the server, so that it can run close to the database, and communicate with the client at a higher level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM