1

I'm using netbeans to create a simple java maven application with a very simple JavaDB database connectivity. I've configured the dependencies in maven pom.xml file as follows, and my application works correctly when I run it from the IDE.

pom.xml

<dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derby</artifactId>
        <version>10.12.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbyclient</artifactId>
        <version>10.12.1.1</version>
    </dependency>

Yet when I build the project with dependencies and try to run the final jar, I get the following error.

java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/TestDB

I've even tried copying the derby.jar to the application jar file location. But still the above error appears. I'm not sure what I'm doing wrong.

tybandara
  • 279
  • 2
  • 10
  • 1
    U have to pay attention to classpath. When u start u jar file, derby.jar should be in classpath – simar Apr 18 '16 at 13:38
  • @simar due to the format of the JDBC Connection URL, it is actually derbyclient.jar that is needed to provide the Derby ClientDriver implementation. – Bryan Pendleton Apr 18 '16 at 13:45
  • U are right, I just looked on docs, derbyclient.jar is right way. – simar Apr 18 '16 at 13:47

0 Answers0