Juman Amen
Juman Amen

Reputation: 3

Jar file can't access Mysql database when moved to another computer

What the title says, basically. I have created a program for managing a database, and it worked perfectly inside and outside of the Netbeans IDE. However, as soon as I move it to another computer it can't access the database anymore. I don't know what the problem is, both computers are on the same LAN so they should be able to access the same localhost.

Upvotes: 0

Views: 135

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36203

Your url is:

jdbc:mysql://localhost:3306/javabase

localhost is only valid on your local computer. If you want to access a database on another computer you have to use the hostname or the IP address of this computer.

For example:

jdbc:mysql://192.168.0.110:3306/javabase

Upvotes: 0

Related Questions