playframework - Play can't connect to MySQL -
i having trouble making play connect mysql database. updated application.conf file include database connection info following error:
creationexception: unable create injector, see following errors:1) error in custom provider, configuration error: configuration error[cannot connect database [default]] while locating play.api.db.dbapiprovider while locating play.api.db.dbapi field @ play.api.db.nameddatabaseprovider.dbapi(dbmodule.scala:80) while locating play.api.db.nameddatabaseprovider @ com.google.inject.util.providers$guicifiedproviderwithdependencies.initialize(providers.java:149) @ play.api.db.dbmodule$$anonfun$nameddatabasebindings$1.apply(dbmodule.scala:34): binding(interface play.api.db.database qualified qualifierinstance(@play.db.nameddatabase(value=default)) providertarget(play.api.db.nameddatabaseprovider@14190249)) (via modules: com.google.inject.util.modules$overridemodule -> play.api.inject.guice.guiceablemoduleconversions$$anon$1) caused by: configuration error: configuration error[cannot connect database [default]]
here application.conf file:
db.default.driver=com.mysql.jdbc.driver db.default.url="jdbc:mysql://localhost:3306/appdb" db.default.username=root db.default.password="root" ebean.default = ["models.*"] db.default.jndiname = defaultds # jpa configuration jpa.default = defaultpersistenceunit
i using gradle building everything, , added needed dependencies (from build.gradle):
dependencies { play "org.hibernate:hibernate-entitymanager:4.3.10.final" play "com.typesafe.play:play-java-jpa_2.11:2.4.2" play "com.typesafe.play:play-java-jdbc_2.11:2.4.3" }
i can connect database (yes, have appdb created) using mysql workbench without problems , have data inserted.
i searched on multiple sources, no luck. appreciated.
in case others having same problem, correct import not com.typesafe.play:play-java-jdbc_2.11:2.4.3 use mysql:mysql-connector-java:5.1.36 , work.
Comments
Post a Comment