Connecting Java Eclipse with remote database on the internet

Asked By 20 points N/A Posted on -
qa-featured

Hi!

Can you give me information about Java Eclipse? I am trying to connect it to a database save in a website. I just don’t know how to do that? Can you please help me work with this? What are the codes I can use to connect it properly and to retrieve data from it? I am not sure but my co-workers said that it will require few declarations with java to make this work? Can you provide me alternative solutions for this? Please help me, thank you!

SHARE
Answered By 0 points N/A #192687

Connecting Java Eclipse with remote database on the internet

qa-featured

All you need is to supply the IP / hostname of the remote machine in your database connection string, instead of localhost. For example:



jdbc:mysql://192.168.15.25:3306/yourdatabase



And make sure there is no firewall blocking the access to port 3306



Also, you have to make sure that the user you are connecting with is allowed to connect from this particular hostname.

For development environments it is safe to do this by 'username'@'%'.

Check the user creation manual and the GRANT manual at https://dev.mysql.com/

Answered By 0 points N/A #192686

Connecting Java Eclipse with remote database on the internet

qa-featured

All you need is to supply the IP / hostname of the remote machine in your database connection string, instead of localhost. For example:



jdbc:mysql://192.168.15.25:3306/yourdatabase



And make sure there is no firewall blocking the access to port 3306



Also, you have to make sure that the user you are connecting with is allowed to connect from this particular hostname.

For development environments it is safe to do this by 'username'@'%'.

Check the user creation manual and the GRANT manual at https://dev.mysql.com/

Related Questions