【发布时间】:2017-06-17 15:13:38
【问题描述】:
我的 Spring Boot 应用程序使用 DataNucleus 作为持久性管理器,在我的 maven pom.xml 中与这个 mySQL 版本配合得很好:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version>
</dependency>
根据documentation 中的升级过程使用新名称定义连接:
properties.setProperty("javax.jdo.option.ConnectionDriverName", "com.mysql.cj.jdbc.Driver");
我正在尝试升级到最新的 mySQL 连接器 6.0.6 - 但即使我升级到高于我正在使用的任何版本(例如 5.1.42)
这是新的 Maven 条目:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
当我切换到这个和新的驱动程序名称时
我得到一个非常明显的错误
The specified datastore driver ("com.mysql.cj.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
我的其余连接信息定义为
Properties properties = new Properties();
properties.setProperty("javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
properties.setProperty("javax.jdo.option.ConnectionURL", url);
properties.setProperty("javax.jdo.option.ConnectionDriverName", "com.mysql.cj.jdbc.Driver");
properties.setProperty("javax.jdo.option.ConnectionUserName", login);
properties.setProperty("javax.jdo.option.ConnectionPassword", password);
properties.setProperty("org.jpox.identifier.case", "PreserveCase");
properties.setProperty("datanucleus.schema.autoCreateAll", "true");
properties.setProperty("datanucleus.query.sql.allowAll", "true");
properties.setProperty("datanucleus.schema.autoCreateTables", "true");
有什么建议吗?
【问题讨论】:
-
我可以建议你阅读the documentation吗?
-
永远不会! :) 是的,我只是遗漏了一些东西 - 我在文档中遇到了与驱动程序名称相同的错误:“com.mysql.cj.jdbc.Driver”
标签: java mysql spring maven datanucleus