jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]
jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]
为啥报错
因为你在persistence.xml中没配置你数据库的相应信息
咋解决
persistence.xml在哪里?
咋编辑这东西?
咋配置
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Project1_Group5_ClientTierApp"
transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.client.jpa.User</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/webdevelopmentpracticuum_database?characterEncoding=UTF-8" />
<property name="javax.persistence.jdbc.user" value="你账号一般是root看你改没改过" />
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.password" value="你密码,我不能告诉你我自己的 />
<property name="eclipelink.ddl-generation" value="create-tables" />
<property name="eclipelink.jdbc.connections.min" value="1" />
<property name="eclipelink.jdbc.connections.max" value="2" />
<property name="eclipelink.logging.level" value="FINEST" />
</properties>
</persistence-unit>
</persistence>