hi,
ich versuche auf meinen server mit jdbc zuzugreifen und bekomme andauernd diese fehler
Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused
zusätzliche systemouts.
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:1564)
at com.mysql.jdbc.Connection.(Connection.java:485)
at com.mysql.jdbc.Driver.connect(Driver.java:341)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at net.maxcity.util.register.HelloMySQL.main(HelloMySQL.java:34)
SQLExecption: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect
SQLState: 08S01
VendorError: 0
Der source code sieht wiefolgt aus.
import java.sql.*;
public class HelloMySQL{
static String ConnectURL = „jdbc:mysql://111.111.111.111/dbname“;
public static void main(String Args[]) {
try {
Class.forName(„com.mysql.jdbc.Driver“).newInstance();
} catch (Exception e) {
System.err.println(„Unable to load driver.“);
System.err.println(e);
e.printStackTrace();
System.exit(-1);
}
System.out.println(„Driver loaded okay.“);
try {
Connection conn =
DriverManager.getConnection(ConnectURL,„user“,„pw“);
} catch (SQLException e) {
System.err.println(„Driver can’t get a connection.“);
e.printStackTrace();
System.err.println("SQLExecption: " + e.getMessage());
System.err.println("SQLState: " + e.getSQLState());
System.err.println("VendorError: " + e.getErrorCode());
System.exit(-1);
}
System.out.println(„We have a connection!“);
}
}
Hilfe es geht nicht. Die Daten sind okay, hab mich mal mit php konnekiert. mein lokaler suse-server funzt auch nur dieser server will nicht. Hat jemand eine Idee. das wäre ziemlich cool,
thx,
gruss ming