Re: java.sql.SQLException: No suitable driver found for jdbc:derby:memory:sampledb;create=true

2020-06-25 Thread Russell Bateman
Oops. I spoke too soon. I still had my JUnit tests @Ignore'd. It doesn't 
work yet. I still get "no suitable driver." I added derbytools too, but 
that made no difference. Further thoughts?



On 6/25/20 5:01 PM, Russell Bateman wrote:
Thank you; that's very kind. It now works. (I'm not using DataSources 
for now.) I greatly appreciate your help.


Best regards,
Russ

On 6/25/20 4:48 PM, Rick Hillegas wrote:
The 10.15 family of releases introduced a JPMS modularization of 
Derby. That re-factored the code a bit. You will need to add 
derbyshared.jar to the classpath and build dependencies. If you are 
using DataSources, then you will also need to add derbytools.jar. 
Please see the detailed release note for DERBY-6945 on the 10.15.1.3 
download page: 
http://db.apache.org/derby/releases/release-10.15.1.3.html


Hope this helps,
-Rick

On 6/25/20 1:28 PM, Russell Bateman wrote:

I have very recent code that works in a JUnit test case.

   @Test
   public void test()
   {
      final String DATABASE = "jdbc:derby:memory:sampledb;create=true";
      final String USERNAME = "sa";
      final String PASSWORD = "sa";

      final String CREATE_TABLE = "CREATE TABLE names ( oid INT
   GENERATED ALWAYS AS IDENTITY, name VARCHAR( 20 ) )";
      final String INSERT_NAME1 = "INSERT INTO names ( name ) VALUES (
   'Jack' )";
      final String QUERY    = "SELECT oid, name FROM names";

      Connection connection = null;

      try
      {
        connection = DriverManager.getConnection( DATABASE, USERNAME,
   PASSWORD );

        Statement statement = connection.createStatement();
        ...

In /pom.xml/, I have the following:

   
      org.apache.derby
      *derby*
      10.15.2.0
      test
   

I only want to use Derby _in-memory_ backing some unit test cases 
that need a database (not requiring a running server or dæmon, 
etc.). It all works perfectly inside IntelliJ IDEA.


However, when I build from the command line (mvn clean package), I 
see this and can find no solution:


   java.sql.SQLException: No suitable driver found for
   jdbc:derby:memory:sampledb;create=true
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at
com.imatsolutions.database.ApacheDerbyTest.testDirectlyToDerby(ApacheDerbyTest.java:78) 



In /pom.xml/, I have tried adding the following, and I have tried 
many other solutions, some of which are supposed to be obsolete ( 
Class.for(...), DriverManager.registerDriver( ... ), etc. ), but 
cannot find a happy solution.


   
      org.apache.derby
      *derbyclient*
      10.15.2.0
      test
   

Any comment would be welcome.

Thanks.










Re: java.sql.SQLException: No suitable driver found for jdbc:derby:memory:sampledb;create=true

2020-06-25 Thread Russell Bateman
Thank you; that's very kind. It now works. (I'm not using DataSources 
for now.) I greatly appreciate your help.


Best regards,
Russ

On 6/25/20 4:48 PM, Rick Hillegas wrote:
The 10.15 family of releases introduced a JPMS modularization of 
Derby. That re-factored the code a bit. You will need to add 
derbyshared.jar to the classpath and build dependencies. If you are 
using DataSources, then you will also need to add derbytools.jar. 
Please see the detailed release note for DERBY-6945 on the 10.15.1.3 
download page: http://db.apache.org/derby/releases/release-10.15.1.3.html


Hope this helps,
-Rick

On 6/25/20 1:28 PM, Russell Bateman wrote:

I have very recent code that works in a JUnit test case.

   @Test
   public void test()
   {
      final String DATABASE = "jdbc:derby:memory:sampledb;create=true";
      final String USERNAME = "sa";
      final String PASSWORD = "sa";

      final String CREATE_TABLE = "CREATE TABLE names ( oid INT
   GENERATED ALWAYS AS IDENTITY, name VARCHAR( 20 ) )";
      final String INSERT_NAME1 = "INSERT INTO names ( name ) VALUES (
   'Jack' )";
      final String QUERY    = "SELECT oid, name FROM names";

      Connection connection = null;

      try
      {
        connection = DriverManager.getConnection( DATABASE, USERNAME,
   PASSWORD );

        Statement statement = connection.createStatement();
        ...

In /pom.xml/, I have the following:

   
      org.apache.derby
      *derby*
      10.15.2.0
      test
   

I only want to use Derby _in-memory_ backing some unit test cases 
that need a database (not requiring a running server or dæmon, etc.). 
It all works perfectly inside IntelliJ IDEA.


However, when I build from the command line (mvn clean package), I 
see this and can find no solution:


   java.sql.SQLException: No suitable driver found for
   jdbc:derby:memory:sampledb;create=true
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at
com.imatsolutions.database.ApacheDerbyTest.testDirectlyToDerby(ApacheDerbyTest.java:78) 



In /pom.xml/, I have tried adding the following, and I have tried 
many other solutions, some of which are supposed to be obsolete ( 
Class.for(...), DriverManager.registerDriver( ... ), etc. ), but 
cannot find a happy solution.


   
      org.apache.derby
      *derbyclient*
      10.15.2.0
      test
   

Any comment would be welcome.

Thanks.








Re: java.sql.SQLException: No suitable driver found for jdbc:derby:memory:sampledb;create=true

2020-06-25 Thread Rick Hillegas
The 10.15 family of releases introduced a JPMS modularization of Derby. 
That re-factored the code a bit. You will need to add derbyshared.jar to 
the classpath and build dependencies. If you are using DataSources, then 
you will also need to add derbytools.jar. Please see the detailed 
release note for DERBY-6945 on the 10.15.1.3 download page: 
http://db.apache.org/derby/releases/release-10.15.1.3.html


Hope this helps,
-Rick

On 6/25/20 1:28 PM, Russell Bateman wrote:

I have very recent code that works in a JUnit test case.

   @Test
   public void test()
   {
      final String DATABASE = "jdbc:derby:memory:sampledb;create=true";
      final String USERNAME = "sa";
      final String PASSWORD = "sa";

      final String CREATE_TABLE = "CREATE TABLE names ( oid INT
   GENERATED ALWAYS AS IDENTITY, name VARCHAR( 20 ) )";
      final String INSERT_NAME1 = "INSERT INTO names ( name ) VALUES (
   'Jack' )";
      final String QUERY    = "SELECT oid, name FROM names";

      Connection connection = null;

      try
      {
        connection = DriverManager.getConnection( DATABASE, USERNAME,
   PASSWORD );

        Statement statement = connection.createStatement();
        ...

In /pom.xml/, I have the following:

   
      org.apache.derby
      *derby*
      10.15.2.0
      test
   

I only want to use Derby _in-memory_ backing some unit test cases that 
need a database (not requiring a running server or dæmon, etc.). It 
all works perfectly inside IntelliJ IDEA.


However, when I build from the command line (mvn clean package), I see 
this and can find no solution:


   java.sql.SQLException: No suitable driver found for
   jdbc:derby:memory:sampledb;create=true
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at
com.imatsolutions.database.ApacheDerbyTest.testDirectlyToDerby(ApacheDerbyTest.java:78)

In /pom.xml/, I have tried adding the following, and I have tried many 
other solutions, some of which are supposed to be obsolete ( 
Class.for(...), DriverManager.registerDriver( ... ), etc. ), but 
cannot find a happy solution.


   
      org.apache.derby
      *derbyclient*
      10.15.2.0
      test
   

Any comment would be welcome.

Thanks.






java.sql.SQLException: No suitable driver found for jdbc:derby:memory:sampledb;create=true

2020-06-25 Thread Russell Bateman

I have very recent code that works in a JUnit test case.

   @Test
   public void test()
   {
  final String DATABASE = "jdbc:derby:memory:sampledb;create=true";
  final String USERNAME = "sa";
  final String PASSWORD = "sa";

  final String CREATE_TABLE = "CREATE TABLE names ( oid INT
   GENERATED ALWAYS AS IDENTITY, name VARCHAR( 20 ) )";
  final String INSERT_NAME1 = "INSERT INTO names ( name ) VALUES (
   'Jack' )";
  final String QUERY    = "SELECT oid, name FROM names";

  Connection connection = null;

  try
  {
    connection = DriverManager.getConnection( DATABASE, USERNAME,
   PASSWORD );

    Statement statement = connection.createStatement();
    ...

In /pom.xml/, I have the following:

   
  org.apache.derby
  *derby*
  10.15.2.0
  test
   

I only want to use Derby _in-memory_ backing some unit test cases that 
need a database (not requiring a running server or dæmon, etc.). It all 
works perfectly inside IntelliJ IDEA.


However, when I build from the command line (mvn clean package), I see 
this and can find no solution:


   java.sql.SQLException: No suitable driver found for
   jdbc:derby:memory:sampledb;create=true
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at
   
com.imatsolutions.database.ApacheDerbyTest.testDirectlyToDerby(ApacheDerbyTest.java:78)

In /pom.xml/, I have tried adding the following, and I have tried many 
other solutions, some of which are supposed to be obsolete ( 
Class.for(...), DriverManager.registerDriver( ... ), etc. ), but cannot 
find a happy solution.


   
  org.apache.derby
  *derbyclient*
  10.15.2.0
  test
   

Any comment would be welcome.

Thanks.