PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 14, 2022

[FIXED] Upload MySQL database and access on Java application from a remote system

 March 14, 2022     java, jdbc, mamp, mysql, phpmyadmin     No comments   

Issue

I recently built a desktop application using Java for the frontend and MySQL for the backend database. Now I want everyone else to be able to use this application too.

So my question is how can I upload my MySQL database online and so that the application can access it remotely? What changes should I make in my I used MAMP to create and setup this database. The first thing I did was....

connection = DriverManager.getConnection("jdbc:mysql://" + host + "/" + database, username, password);

Then I added a new MySQL user using

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

and I also created a my.cnf file and added

bind-address = 192.168.1.45

Now on the remote system I get the

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Solution

If you want your database to be accessed from outside you have to host it to a server, you have the option to do it locally (you have to setup a local server) or using a database cloud service like Azure or Amazon Web Services (AWS).

Edit: I also found this for you:
www.GearHost.com provides free hosting for both MS SQL and MySQL. The limit on free database MSSQL is 10 MB.

Source: https://www.quora.com/Is-there-any-free-SQL-Server-hosting-available

https://aws.amazon.com/free/ that's a service offered by Amazon which lets you host your database for 12 Months for free, after that you'll get charged (or not) depending on the Tier you've chosen.



Answered By - Anwar Benhamada
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing