Connecting a Java Desktop Application to Remote MySQL Instance
Posted by: Christian Antfeld
Date: November 01, 2019 01:44PM

I am writing a Java application to access values in a remote MySQL instance. Everything I have read about connecting to the DB has been using "localhost" through JDBC in the URL. A tutorial I read said that the IP address can be used instead leading me to wonder if I could use the IP address to access a remote server.

The Setup:

1. Java Application on a Mac sending queries and changes for and to the DB values.

2. MySQL instance running on a separate computer (a laptop for now as this is an at home project).

3. The two computers will be on the same network when queries will be tested from the Java application. A second LAN within the house will make the connection for the two devices.

Main questions:

1. Are there differences between connecting to the server from within the LAN when compared to accessing a server over a LAN-WAN-LAN type of connection? If so, what are they?

2. Will putting in the IP for the server device instead of "localhost" work when the two devices are connected to the same LAN? Logic tells me it will but there is much I don't know about networking and application networking.

Options: ReplyQuote

Written By
Connecting a Java Desktop Application to Remote MySQL Instance
November 01, 2019 01:44PM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.