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-"

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 - - (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

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/

unzip -j ~/Downloads/ "db-derby-"
unzip -j ~/Downloads/ "db-derby-"
unzip -j ~/Downloads/ "db-derby-"
unzip -j ~/Downloads/ "db-derby-"
unzip -j ~/Downloads/ "db-derby-"

java -cp derby.jar

------------------ 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 Platform API Specification
java.specification.version: 1.8
java.runtime.version: 1.8.0_181-b13
--------- Derby Information --------
[/Users/davidhay/ApacheDerby/derby.jar] - (1828579)
----------------- Locale Information -----------------

This was definitely of use in my PD

No comments:

The Modern Mainframe Developer Hands On Drop-In Centre - Thursday, May 2, 2019

Come along at any time, grab a machine and away you go. Refreshments and snacks will be provided. This first meetup is funded by IBM. The ...