首页 > Web开发 > 详细

jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]

时间:2019-11-17 21:48:10      阅读:80      评论:0      收藏:0      [点我收藏+]

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>

jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]

原文:https://www.cnblogs.com/mengxiaoleng/p/11878326.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!