私はplay java 2.5を使用しています。 次のJavaコードでデータベースを作成しました。データベースを作成するJavaの進化
public OnStartup() throws SQLException {
//demo create database with java code
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/?user=root&password=12345678");
Statement s = con.createStatement();
int Result = s.executeUpdate("CREATE DATABASE recruit3");
}
モジュール:
public class OnStartupModule extends AbstractModule {
@Override
public void configure() {
bind(OnStartup.class).asEagerSingleton();
}
}
はapplication.conf:
play.modules {
enabled += "be.objectify.deadbolt.java.DeadboltModule"
enabled += modules.CustomDeadboltHook
enabled += modules.OnStartupModule
}
default.driver=com.mysql.jdbc.Driver
default.url="jdbc:mysql://localhost:3306/recruit3"
default.username=root
default.password="12345678"
私の質問は、なぜそれを修正する方法
error Cannot connect to database [default]
を作成するウェブアプリを実行しています、私がデータベースを作成したくないSQLワークベンチ。
ご提案がある場合やできない場合は、教えてください。 進んでいただきありがとうございます。
すごく、答えてくれてありがとう、私は今しようとする。 –