0

I have created a java application which connects to a mysql database using the JDBC driver. I have the mysql server running on the same machine as my java application.

When I connect to the database on localhost the application is working fine. My system in connected to other systems via LAN. Now i want to run my application on these systems connecting to the database on the mysql server i have on my system.

What changes do i need to make in my mysql workbench or the java application to deploy this. I have mysql 6.1 workbench installed.

I am getting the following error:

run: Communications link failure

 Last packet sent to the server was 0 ms ago. Exception in thread
 "AWT-EventQueue-0" java.lang.NullPointerException
         at help.helpdesk.Ready(helpdesk.java:97)
         at help.helpdesk.<init>(helpdesk.java:89)
         at help.helpdesk$6.run(helpdesk.java:428)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) BUILD
 SUCCESSFUL (total time: 22 seconds)

when I try to connect to the database on my local server by using the ip address of my system.

earthmover
  • 4,395
  • 10
  • 43
  • 74
sky3287944
  • 39
  • 1
  • 1
  • 12

2 Answers2

4

You need to do following changes

1.Edit the my.cnf

mysql/my.cnf 

change the local ip

bind-address  = 192.168.1.2("your system ip")

2.restart the mysql server

and if you want connect to your database remotely than this link will helpful for you

Gabber
  • 7,169
  • 3
  • 32
  • 46
  • @sky3287944 try /etc/mysql/my.cnf – Gabber Jun 10 '14 at 06:39
  • sorry @sky3287944 i am using ubuntu,so i have no idea about my.cnf on window,but window mysql configuration may be path is C:\Program Files\MySQL\MySQL Server 5.5\my.cnf – Gabber Jun 10 '14 at 06:48
  • @sky3287944 http://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql similar question – Gabber Jun 10 '14 at 06:50
4

If you set bind-address = 0.0.0.0 in /etc/my.cnf, MySQL will be available across all interfaces both locally and over the network.

Matt
  • 175
  • 5