You are not logged in.

#1 2012-08-31 23:29:51

From: Scotland
Registered: 2012-03-06
Posts: 15

[SOLVED] Arch and Netbeans mysql communication failure

Hi Guys,

This problem has had me pulling my hair out for a week.

Really stumped.

I am trying to connect to mysql with an application in netneans.

Sep 01, 2012 12:45:38 AM sqltest.SqlTest main
SEVERE: null
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Caused by: Connection refused

Now I can connect with phpmyadmin, connect to mysql on the terminal. So mysql is installed correctly. I netbeans is installed correctly also. If I try and activate mysql via the services tab I get a connection refused message.

Netbeans mysql Server properties...

Server Host Name: localhost.
Server port number: 3306
Administrator User Name: root
Administrator Password: xxxxxx

Admin Properties...

Path/url to admin tool: /usr/bin/mysqladmin (no arguments)
Path to start command: /usr/bin/mysqld (no arguments)
Path to stop command : /usr/bin/mysqladmin (arguments: -u root stop)

The java mysql driver is present and included...
#skip-networking commented in /etc/my.cnf
All mysql files seem to have the relevant permissions...mysql:mysql.

maybe someone else has come accross this error and solved it.

Error states in the Netbeans IDE when I try and start in servces tab in netbeans...

120831 23:15:05 [Warning] Can't create test file /var/lib/mysql/archvm.lower-test
120831 23:15:05 [Warning] Can't create test file /var/lib/mysql/archvm.lower-test
/usr/bin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
120831 23:15:05 [ERROR] Aborting

120831 23:15:05 [Note] /usr/bin/mysqld: Shutdown complete

Any ideas before the PC goes out the window.

Last edited by longmains (2012-09-01 08:43:19)


#2 2012-09-01 08:42:12

From: Scotland
Registered: 2012-03-06
Posts: 15

Re: [SOLVED] Arch and Netbeans mysql communication failure

Hold back on throwing the PC out the window...

Not quite sure how I solved it but it is now working. As I said before I commented out skip-networking in my.cnf. Services tab in netbeans, set properties as above.

Tried connected to mysql in the terminal specifying the port - worked fine

mysql -P3306 -u root -p

Then I went back into the services tab in netbeans...choose databses > on mysql I chose connect (not start) - did not work. Still under databases I chose the drivers then the mysql j connector. hit connect but that did not work. Removed the j connector from my application in the projects. Closed netbeans.

Edited /etc/hosts (as root)

#/etc/hosts: static lookup table for host names

#<ip-address>    <>    <hostname>    localhost.localdomain    localhost
::1        localhost.localdomain    localhost
# add following line - not sure if made a difference but it works with it in
#End of file

restarted the mydqld daemon

rc.d restart mysqld

Started netbeans again - went to the services tab - hey presto mysql was connected without doing anything.

Back to my application in projects- added the j connector in the properties > libraries > run tab,  - rebiuld project and it run fine.

Last edited by longmains (2012-09-01 08:47:35)


Board footer

Powered by FluxBB