게임 2에서 ScalaQuery를 사용하려고하는데, 적절한 드라이버가 없습니다 ... '오류가 발생합니다. 데이터베이스 연결은 Anorm/Nina와 잘 작동합니다. 나는 SBT 의존성 추가 Play 2.0에서 MySQL 드라이버를 찾지 못했습니다.
object Client extends Table[(Int, String)]("Client") {
val database = Database.forURL("jdbc:mysql://localhost/play2test", driver = "com.mysql.jdbc.Driver" , user="root", password="root")
def id = column[Int]("id", O NotNull, O AutoInc)
def name = column[String]("name", O NotNull)
def * = id ~ name
def findAll = database.withSession {
implicit db: Session =>
(for (t <- this) yield t.id ~ t.name).list
}
}
: 가 여기 내 ScalaQuery 코드의
"mysql" % "mysql-connector-java" % "5.1.21"
을 내가 application.conf
db.default.driver=com.mysql.jdbc.Driver
db.default.url="mysql://root:[email protected]/play2test"
db.default.user=root
db.default.password=root
에이 (내가 따라 forDataSource 방법을 사용하려 게임의 DB.getDataSource()를 사용했지만 더 좋은 결과를 얻지 못했습니다.
하나의 어색한 일은 com.mysql._을 가져올 수 없다는 것입니다. 따라서 분명히 드라이버는 다운로드되지 않았습니다. 항아리를 다운로드하고 프로젝트의/lib 폴더에 수동으로 추가하려고했지만 가져 오기가 여전히 작동하지 않습니다.
저는 막혔습니다. 조금만 도와주세요. 편집 :(
: 는 나는 "MySQL의 : JDBC // 로컬 호스트/play2test"를 삭제하고 (다른 스레드에서 그 팁 있음)을 rewrited 지금은 새로운 문제에 봉착 :
[MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '."id","t1"."name" FROM "Client" "t1"' at line 1]
을
은 왜를 변경하는 MySQL과 방법은 큰 따옴표를 사용하여 ScalaQuery입니다
Edit2가 : 문제 해결, 내가 ScalaQuery의 SQL 드라이버에 대한 잘못된 가져 오기를했다
다행히 문제를 해결 했으므로 답변을 추가하고 가능한 경우 올바른 것으로 표시하십시오. (다음 2 일) – biesior