ich versuche auf folgende weise eine verbindung zu einer mysql db herzustellen:
nur leider bekomme ich zur laufzeit an dieser stelle immer folgenden fehler:
ich hab echt keine Ahnung, warum das nicht geht =( .. soweit ich weiß ist das richtig...
ich benutze den "mysql-connector-java-5.0.5" und den Treiber lade ich so:
Code:
//Making a Connection
try {
con = DriverManager.getConnection("jdbc:mysql://imageup.hosting-sector.de/web7_db1");
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Unable to establish Connection!");
System.err.println("Error Message: " + ex.getMessage());
System.err.println("SQL State: " + ex.getSQLState());
System.err.println("Cause: " + ex.getCause());
System.err.println("Error Code: " + ex.getErrorCode());
}
nur leider bekomme ich zur laufzeit an dieser stelle immer folgenden fehler:
Code:
Error Message: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection timed out: connect
STACKTRACE:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:267)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2739)
at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Uploader.getPicNumb(Uploader.java:86)
at Uploader.upload(Uploader.java:45)
at GUI.actionPerformed(GUI.java:126)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
** END NESTED EXCEPTION **
Last packet sent to the server was 50 ms ago.
SQL State: 08S01
Cause: null
Error Code: 0
ich hab echt keine Ahnung, warum das nicht geht =( .. soweit ich weiß ist das richtig...
ich benutze den "mysql-connector-java-5.0.5" und den Treiber lade ich so:
Code:
//Loading the Driver
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null, "Unable to load MySQL Driver");
} catch (IllegalAccessException ex) {
System.err.println(ex.getMessage());
} catch (InstantiationException ex) {
System.err.println(ex.getMessage());
}