我正在尝试将我的程序连接到我们的主服务器,但它不起作用。当我登录时,这是发生的错误,
Connection error:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Cannot load connection class because of underlying exception:
'java.lang.NumberFormatException:For input string:"192.168.10.105"'.
这是我的代码,在我的课堂上,我将它连接到服务器的数据库:
package login;
import java.sql.*;
import javax.swing.JOptionPane;
public class DatabaseCls {
public Connection con;
private void conData() {
try {
String host = "jdbc:mysql://ipAddress:192.168.10.105/eqod-log";
String uName = "localhost";
String uPass= "eq0d.c0m";
con = DriverManager.getConnection(host, uName, uPass);
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Connection Error", JOptionPane.ERROR_MESSAGE);
}
}
public ResultSet rsFetch(String query) {
ResultSet rs = null;
try {
conData();
rs = con.createStatement().executeQuery(query);
return rs;
}
catch(Exception e) {
JOptionPane.showMessageDialog(null, e, "ResultSet Query Error", JOptionPane.ERROR_MESSAGE);
return rs;
}
}
public boolean exSQL(String query) {
boolean done;
try {
done = true;
conData();
con.createStatement().execute(query);
con.close();
return done;
}
catch(Exception e) {
done = false;
JOptionPane.showMessageDialog(null, e, "Query Error", JOptionPane.ERROR_MESSAGE);
return done;
}
}
}
你能帮我解决这个问题吗,我刚开始使用java