我在openshift上面临数据库连接问题,下面的代码在一个月之前工作但是现在它返回null,我的连接代码是:
package com.connection;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Connect {
public static Connection DB() {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://127.8.250.130:3306/enc", "admin","pass");
} catch (Exception ex) {
Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null,ex);
}
return con;
}
}