私はJavaアプリケーションを開発しました。これをdb4free.net
がホストするオンラインMySQLデータベースに接続したいと考えています。しかし、私はJDBCを使って接続することはできません。私が使っているURLに何か問題があることを知っています。私は私のブラウザでご覧くださいURLは次のとおりです。Java apをオンラインMySQLデータベースに接続できません - 間違ったURL
public class ReadProperties {
private String db_user;
private String db_password;
private String db_connection;
private Connection connection;
public ReadProperties(String filename){
Properties propfile = new Properties();
InputStream input = null;
try {
input = new FileInputStream(filename);
propfile.load(input);
db_user = propfile.getProperty("db_user");
db_password = propfile.getProperty("db_password");
db_connection = propfile.getProperty("db_connection");
connection = DriverManager.getConnection(db_connection, db_user, db_password);
System.out.println(connection);
} catch (IOException | SQLException ex) {
ex.printStackTrace();
}
finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
そして、私のプロパティファイル:
db_user=USERNAME
db_password=PASSWORD
db_driver=com.mysql.jdbc.Driver
db_connection=jdbc:mysql://db4free.net/DB_NAME
何URLを正確にすべき
https://db4free.net/phpMyAdmin/index.php?db=DB_NAME&target=db_structure.php&token=8d68285c6950611a4f9630dc2c132b61
これは私がプロパティを読み取る方法です私が使う?これは、(私はデータベースの名前を消去している)私はphpMyAdminの中で見たものである。
データベースにpingを実行しましたか? –
ドメインの名前を実際の@IP –
@LAIDANIYoucefに変更することができますか?私はドメイン名をpingしました。IPは'85.10.205.173'です。 – Marievi