简体   繁体   中英

Driver not found: [com.mysql.jdbc.Driver] play framework

It keeps throwing this error no matter what i do. I have added the dependencies, I have added the jar, I have also made required changes in application.conf. No clue what's wrong.

my application.conf:

db.default.driver=com.mysql.jdbc.Driver
db.default.url="mysql://127.0.0.1:3306"
db.default.user=root
db.default.password="password"

my Build.scala

val appDependencies = Seq(
    "mysql" % "mysql-connector-java" % "5.1.40"
)
// i am using mysql 5.7.17, connector/j is 5.1.40

my plugin.sbt file:

libraryDependencies ++= Seq(
  javaJdbc,
  "mysql" % "mysql-connector-java" % "5.1.40"
)

It still keeps throwing the same error. I am using play 2.2.6!

db.default.driver=com.mysql.jdbc.Driver
**db.default.url="jdbc:mysql://127.0.0.1:3306/databaseName"**
db.default.user=root
db.default.password="password"

Url wrong ???

Configure MySQL database correctly with proper character encoding:

db.default.driver=com.mysql.jdbc.Driver

db.default.url="jdbc:mysql://127.0.0.1:3306/databaseName?characterEncoding=UTF-8"

db.default.user=root

db.default.password="password"

Remove your configuration

Add below lines to application.conf with your db details.

db.default.driver="com.mysql.jdbc.Driver"
db.default.url="jdbc:mysql://localhost:3306/dbName"
db.default.user="user"
db.default.password="password"

Add dependence to build.sbt

"mysql" % "mysql-connector-java" % "5.1.30"

Then do activator run

If it still doesnt work try

activator clean
activator run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM