简体   繁体   English

将 MySQL 连接器 Jar 链接到我的依赖项 Java Play Framework 1.x

[英]Linking MySQL Connector Jar To My Dependencies Java Play Framework 1.x

Using the following connection string credentials in my application.conf file:在我的 application.conf 文件中使用以下连接字符串凭据:

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

I get the following error in the console:我在控制台中收到以下错误:

A database error occured : Cannot connected to the database[default], No suitable driver found for mysql://localhost:3306/test

So then in my project/lib directory, I have placed the following jar:然后在我的 project/lib 目录中,我放置了以下 jar:

mysql-connector-java-5.1.48

What is the proper syntax then, to include in my dependency file?那么,包含在我的依赖文件中的正确语法是什么? This is how it looks now:这是它现在的样子:

require:
    - play

How do I tell this file it needs what's in project/lib?我如何告诉这个文件它需要项目/lib 中的内容?

When you add a JAR file to your project's lib folder, Play FW adds it to classpath by default.当您将 JAR 文件添加到项目的 lib 文件夹时,Play FW 默认将其添加到类路径。 You don't need to tell the framework that the file is there.您不需要告诉框架该文件在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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