好吧,我从使用XAMPP转到现在通过网络主机托管我的Hiscore,我如何编辑此行,使其与之配合使用,当我运行服务器时,它抛出了错误。

public static void createConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            con = DriverManager.getConnection(
                    "jdbc:mysql://fdb4.awardspace.com/", "1191306_hiscores", "passremoved");
            stmt = con.createStatement();
                    Misc.println("Connected");
        } catch (Exception e) {
            Misc.println("Connection Problem");
        }]


曾经是localhost / hiscores,显然不再起作用了。

最佳答案

没有stacktrace,这很难,但是我注意到您缺少URL中的数据库名称,它应该类似于:

con = DriverManager.getConnection(
                    "jdbc:mysql://fdb4.awardspace.com/hiscores", "1191306_hiscores", "passremoved");


注意jdbc:mysql://fdb4.awardspace.com/hiscoresjdbc:mysql://fdb4.awardspace.com/

关于java - MySQL/Java数据库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13371049/

10-11 22:37
查看更多