Wednesday, 14 November 2018

Apache Derby - Networking Notworking

Following my earlier post: -

I've been fiddling with the Apache Derby Network Server

Having unpacked the appropriate derbyrun.jar from the downloaded Derby bundle: -

unzip -j ~/Downloads/db-derby-10.10.2.0-lib.zip "db-derby-10.10.2.0-lib/lib/derbyrun.jar"

I started the server: -

java -jar derbyrun.jar server start

...
Wed Nov 14 16:45:47 GMT 2018 : Security manager installed using the Basic server security policy.
Wed Nov 14 16:45:48 GMT 2018 : Apache Derby Network Server - 10.14.2.0 - (1828579) started and ready to accept connections on port 1527
...

and then tried to connect to the HelloWorld DB using the IJ tool, as before: -

java -cp derbylient.jar:derbytools.jar org.apache.derby.tools.ij


ERROR 08001: No suitable driver found for jdbc:derby://localhost:1527/HelloWorld

I spent many a happy hour digging into this, before I found the solution …..

Yes, PEBCAK aka User Error

I should've started the IJ tool differently: -

java -jar derbyrun.jar ij

select * from names;

...
NUM        |NAME                                    
----------------------------------------------------
1          |Marge Simpson                           
2          |Homer Simpson                           
3          |Lisa Simpson                            
4          |Maggie Simpson                          
5          |Bart Simpson                            
6          |Grandpa Simpson                         

6 rows selected

...

So it's as always, a problem with the class path

So, even though the IJ tool IS available within derbytools.jar it's a different bloomin' version, with the same signature :-)

PS During my investigations, I also upgraded to the most recent version of Derby, albeit to no avail.

-rw-r--r--@ 1 davidhay  staff  12921688 14 Nov 16:14 /Users/davidhay/Downloads/db-derby-10.14.2.0-lib.zip

unzip -j ~/Downloads/db-derby-10.14.2.0-lib.zip "db-derby-10.14.2.0-lib/lib/derby.jar"
unzip -j ~/Downloads/db-derby-10.14.2.0-lib.zip "db-derby-10.14.2.0-lib/lib/derbytools.jar"
unzip -j ~/Downloads/db-derby-10.14.2.0-lib.zip "db-derby-10.14.2.0-lib/lib/derbynet.jar"
unzip -j ~/Downloads/db-derby-10.14.2.0-lib.zip "db-derby-10.14.2.0-lib/lib/derbyrun.jar"
unzip -j ~/Downloads/db-derby-10.14.2.0-lib.zip "db-derby-10.14.2.0-lib/lib/derbyclient.jar"


java -cp derby.jar org.apache.derby.tools.sysinfo

------------------ Java Information ------------------
Java Version:    1.8.0_181
Java Vendor:     Oracle Corporation
Java home:       /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Java classpath:  derby.jar
OS name:         Mac OS X
OS architecture: x86_64
OS version:      10.14.1
Java user name:  davidhay
Java user home:  /Users/davidhay
Java user dir:   /Users/davidhay/ApacheDerby
java.specification.name: Java Platform API Specification
java.specification.version: 1.8
java.runtime.version: 1.8.0_181-b13
--------- Derby Information --------
[/Users/davidhay/ApacheDerby/derby.jar] 10.14.2.0 - (1828579)
------------------------------------------------------
----------------- Locale Information -----------------
------------------------------------------------------
------------------------------------------------------

This was definitely of use in my PD



No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...