3

I just downloaded MySQL Installer and Installed MySQL Server and Workbench on my pc. What i want to ask is:how can i access this database from another computer? Is possible to access to my local Database from a Java Application running on another computer using JDBC? In that case,which JDBC string i have to use? Thanks in advance.

aldoalpha
  • 163
  • 10

1 Answers1

2

localhost is the hostname for each individual computer, so localhost on device A is always going to point back to device A and localhost on device B will always point back to device B, so when you use localhost as the hostname for your database, device B will not find device A.

In order for it to work you'll need some way for the computers to talk to each other, one way is to have them connected by LAN. Then you can substitute the localhost in the jdbc string for the literal hostname of the computer. mysql://localhost/.. becomes mysql://ComputerAHostname/...

If the computers are on the same network you can also set MySQL up as a Server, enable TCP/IP networking and choose a port number on which it will listen. Then when you connect, instead of using "localhost" you can use the literal hostname of the computer, then add a colon :, and then the port number.

Slothrop
  • 142
  • 7