Koozali.org: home of the SME Server

Trouble with connecting to MySQL 4.1 with JAVA

MRTN

Trouble with connecting to MySQL 4.1 with JAVA
« on: April 15, 2005, 12:43:22 PM »
OK, here's my problem, I updated MySQL to version 4.1.11 a couple of days ago, everything seemed to be fine. Connecting through the MySQL-client works great from localhost and the local network, but the official java mysql-connector from the MySQL site does only work within the server (localhost) if I try to connect from the local network I get this:

Code: [Select]

[GameEngineCore] General Exception:
java.sql.SQLException: Unable to connect to any hosts due to exception: java.net
.ConnectException: Connection refused: connect
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1592)
        at com.mysql.jdbc.Connection.<init>(Connection.java:486)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:326)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at GameEngineMainLoop.connect(GameEngineMainLoop.java:324)
        at GameEngineMainLoop.programCheck(GameEngineMainLoop.java:88)
        at GameEngineMainLoop.run(GameEngineMainLoop.java:50)
        at java.util.TimerThread.mainLoop(Unknown Source)
        at java.util.TimerThread.run(Unknown Source)




does anyone have any idea how to solve this, or if this is a known error?

*out MRTN

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Trouble with connecting to MySQL 4.1 with JAVA
« Reply #1 on: April 15, 2005, 10:37:25 PM »
Quote from: "MRTN"
Connecting through the MySQL-client works great from localhost and the local network, but the official java mysql-connector from the MySQL site does only work within the server (localhost) if I try to connect from the local network I get this ...


mysql is configured to not accept any network connections.

I'm sure if you search here hard enough you'll find the steps you need to take to allow network connections.

Skydiver

Re: Trouble with connecting to MySQL 4.1 with JAVA
« Reply #2 on: April 16, 2005, 12:58:26 AM »
Quote from: "MRTN"
I updated MySQL to version 4.1.11 a couple of days ago,

*out MRTN


What ver of SME did you complete the upgrade on and please provide details on how you completed the upgrade.

Thanks

MRTN

Trouble with connecting to MySQL 4.1 with JAVA
« Reply #3 on: April 19, 2005, 10:31:56 AM »
It's SME Server 6.0.1-01 I upgraded, but the problem is already solved, the MySQL driver for JAVA starts making mistakes if old versions of the driver are still in the classpath.

The upgrade was the smeplus sh script, I can recommend it to everyone, adds a lot of useful stuff like DHCP-manager, virusscanner, spamfilter, web statistics and more options in the server-manager.

See here

Quote from: "CharlieBrady"
Quote from: "MRTN"
Connecting through the MySQL-client works great from localhost and the local network, but the official java mysql-connector from the MySQL site does only work within the server (localhost) if I try to connect from the local network I get this ...


mysql is configured to not accept any network connections.

I'm sure if you search here hard enough you'll find the steps you need to take to allow network connections.


Not entirely true, networkconnections from the local network (or VPN connection) are allowed.


*out MRTN

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Trouble with connecting to MySQL 4.1 with JAVA
« Reply #4 on: April 19, 2005, 04:57:12 PM »
Quote from: "MRTN"

Quote from: "CharlieBrady"
Quote from: "MRTN"
Connecting through the MySQL-client works great from localhost and the local network, but the official java mysql-connector from the MySQL site does only work within the server (localhost) if I try to connect from the local network I get this ...


mysql is configured to not accept any network connections.

I'm sure if you search here hard enough you'll find the steps you need to take to allow network connections.


Not entirely true, networkconnections from the local network (or VPN connection) are allowed.


Entirely true, for 6.0, 7.0alpha and I'm fairly sure 6.0.1, unless you have changed the LocalNetworkingOnly property of mysqld from "yes" to "no". By default, mysqld listens *only* to a Unix domain socket (/var/lib/mysql/mysql.sock), and isn't accessible to either the local network or VPN connection.

stbecker

Similar failure
« Reply #5 on: December 28, 2005, 05:07:45 PM »
Hi, I'm having a similar problem on SME7.

...
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused
...

I installed jdk and put the driver in:
/usr/java/jdk1.5.0_06/jre/lib/ext/mysql-connector-java-3.1.12-bin.jar

Would sure like to access MySQL from Java (all on SME).  Any help would be greatly appreciated.

Thanks,
Steve