Java &引用;必须在ConnectionDriverName属性中指定JDBC驱动程序或数据源类名;错误

Java &引用;必须在ConnectionDriverName属性中指定JDBC驱动程序或数据源类名;错误,java,xml,sqlite,jpa,Java,Xml,Sqlite,Jpa,嗨,我正在尝试使用SQLite创建一个简单的JPA类。我已设置好所有设置,然后每次尝试运行main时都会显示: “必须在ConnectionDriverName属性中指定JDBC驱动程序或数据源类名。” 是因为我的sqlite驱动程序名的值错误吗? 我似乎无法找出sqlite的属性值。这是我的persistence.xml: <?xml version="1.0"?> <persistence> <persistence-unit name="tes

嗨,我正在尝试使用SQLite创建一个简单的JPA类。我已设置好所有设置,然后每次尝试运行main时都会显示: “必须在ConnectionDriverName属性中指定JDBC驱动程序或数据源类名。” 是因为我的sqlite驱动程序名的值错误吗? 我似乎无法找出sqlite的属性值。这是我的persistence.xml:

    <?xml version="1.0"?>
<persistence>
    <persistence-unit name="testjpa" transaction-type="RESOURCE_LOCAL">
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>
        <class>entity.Discography</class>
        <properties>
            <property name="openjpa.ConnectionURL" value="jdbc:sqlite:C:\\sqlitedb\\repo.db" />
            <property name="openjpa.ConnectionDriverName" value="org.sqlite.JDBC" />
            <property name="openjpa.ConnectionUserName" value="" />
            <property name="openjpa.ConnectionPassword" value="" />
            <property name="openjpa.Log" value="SQL=TRACE" />
        </properties>
    </persistence-unit>
</persistence>

org.apache.openjpa.persistence.PersistenceProviderImpl
实体椎间盘造影术
谢谢你的帮助!:)

你可以下载驱动程序

使用如下代码:

Class.forName("org.sqlite.JDBC"); // This doesn't actually do anything useful, it just asserts you can find the class
Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
Statement stat = conn.createStatement();
stat.executeQuery("select * from table");

我曾尝试将其用作ConnectionDriverName的值,但错误仍然存在。另外,我已经安装了sqliteJDBC驱动程序。我尝试使用普通的老JDBC,但由于那个错误,我似乎无法使它与使用sqlite的JPA一起工作。有什么想法吗?我尝试使用“org.sqlite.JDBC”作为ConnectionDriverName的值,但仍然显示错误。我试图让sqlite与JPA一起工作。我以前在sqlite中使用过JDBC,它可以工作。我使用了你提供的链接上的代码和驱动程序。
Class.forName("org.sqlite.JDBC"); // This doesn't actually do anything useful, it just asserts you can find the class
Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
Statement stat = conn.createStatement();
stat.executeQuery("select * from table");