I can't import the JDBC Client Driver from the derby package

一笑奈何 提交于 2021-02-10 14:21:12

问题


I have a Java Derby database running in Netbeans and I'm trying to connect to it using the JDBC driver. However, I cannot import the JDBC driver specifically from the org.apache.derby package.

What I've done:

  • My pom.xml file contains the following Maven repo's

    <!-- https://mvnrepository.com/artifact/org.apache.derby/derby -->
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derby</artifactId>
        <version>10.15.1.3</version>
        <type>jar</type>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.derby/derbyclient -->
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbyclient</artifactId>
        <version>10.15.1.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbynet</artifactId>
        <version>10.15.1.3</version>
    </dependency>
    
    • The Derby db properties says the database is using the driver as you can see here

    • When trying to import the JDBC driver, it is seemingly the only thing missing from the derby import list shown in this screenshot

    • I have also downloaded the derby.jar file and copied it directly into C:\Program Files\Java\jdk8-221\bin

I really can't understand why the JDBC driver specifically is missing.


回答1:


I see that you are using release 10.15. In this release, the arrangement of the Derby distribution into jar files has changed, and this is probably affecting you.

Please read the 10.15 Release Notes very carefully, and in particular please carefully look at the section "Note for DERBY-6945" for the details of how you have to change your classpath to access the Derby JDBC driver classes.

Probably, all you have to do is to include derbyshared.jar. But please read the entire thing.



来源:https://stackoverflow.com/questions/58571355/i-cant-import-the-jdbc-client-driver-from-the-derby-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!