To get the SQlite jdbc native image working on OpenVMS I had to debug it with the OpenVMS debugger. Usually debugging on OpenVMS is simple, as you compile and link your code with /DEBUG and run it. But here, the main image is java and the native image is a shareable image which is loaded at run time from the Java code. The approach here is to run Java under the control of the debugger and to stop when the native image was loaded to set a breakpoint within that native image. There are other options to get this native image debugged, for example in adding code to signal ss$_debug.

Because no one else is interested in debugging the jdbc native image, I show how to do this with the OpenVMS/Java supplied jni example. This was on/for I64 but you should be able to do the same on Alpha although the Java version on Alpha is different.

  $ backup sys$common:[java$60.vms_demo]jni_example.sav/sav []
  $ dir

  Directory DISK:[USER]

  EXAMPLE1.JAVA;2     EXAMPLE1_NAT.C;6    JAVA$BUILD_OPTION.EXE;1
  JAVA$STUBS_DEFINED.EXE;1                JNI_EXAMPLE.COM;27  
  JNI_EXAMPLE_31CHARS.COM;9               JNI_README.TXT;2    
  SCAN_FOR_31_CHARS.COM;1                 SCAN_GLOBALS_FOR_OPTION.COM;1

  Total of 9 files.
  $
  $ @sys$common:[java$60.com]java$60_setup
  $ @jni_example
  Starting JNI_EXAMPLE
  The java -version command failed.
  Make sure that JAVA$nnn_SETUP.COM or JAVA$SETUP.COM has been executed.
  11. purging output files
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.obj;*
  -RMS-E-FNF, file not found
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.h;*
  -RMS-E-FNF, file not found
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.opt;*
  -RMS-E-FNF, file not found
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.class;*
  -RMS-E-FNF, file not found
  %DELETE-W-SEARCHFAIL, error searching for DISK:[USER]*.opt;*
  -RMS-E-FNF, file not found
  %DCL-W-INSFPRM, missing command parameters - supply all required parameters
  $

This is an error/problem in the supplied command procedure, we fix it:

  $ java -version
  java version "1.6.0"
  Java(TM) SE Runtime Environment "1.6.0-5"
  Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
  $ sh symb $status
    $STATUS == "%X10000001"
  $
  $ edit/edt jni_example.com
      1       $! JNI_EXAMPLE.COM
  *'java -version
     41       $ java -version
  *
     42       $ if $status .ne. %X10000000 then goto java_failed
  *s/%X10000000/%X10000001/
     42       $ if $status .ne. %X10000001 then goto java_failed
  1 substitution
  *exit
  DISK:[USER]JNI_EXAMPLE.COM;28 225 lines

  $

Another attempt:

  $ @jni_example
  Starting JNI_EXAMPLE
  Using java version:
  java version "1.6.0"
  Versions earlier than 1.1.8-5 or 1.2.2-1 will not be able to
  successfully call the native method example3proc_with_long_name.

  1. compiling example1.java
  2. generating header file example1.h
  3. compiling example1_nat.c (production)

  #include <jni.h>
  .^
  %CC-F-NOINCLFILEF, Cannot find file <jni.h> specified in #include directive.
  at line number 2 in file DISK:[USER]EXAMPLE1.H;1
  11. purging output files
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.obj;*
  -RMS-E-FNF, file not found
  %PURGE-W-SEARCHFAIL, error searching for DISK:[USER]*.opt;*
  -RMS-E-FNF, file not found
  %DELETE-W-SEARCHFAIL, error searching for DISK:[USER]*.opt;*
  -RMS-E-FNF, file not found
  %DCL-W-INSFPRM, missing command parameters - supply all required parameters
  $

This is an other error/problem in the supplied command procedure, we fix it:

  $ jni_verify=1
  $ @jni_example
  ...
  $ java2 = 1     ! Assume this is Java2 (1.2.2 or later)
  $ INCL = "/include=sys$common:[java$122.include...]"
  ...
  $ jni_verify=0

  $ edit/edt jni_example.com
      1       $! JNI_EXAMPLE.COM
  *'122.
     54       $ INCL = "/include=sys$common:[java$122.include...]"
  *
     55       $ if f$locate("1.1.", line)
  *i
              $ if f$locate("1.6.0", line) .ne. f$length(line)
              $ then
              $   INCL = "/include=sys$common:[java$60.include...]"
              $ endif
              ^Z 
     55       $ if f$locate("1.1.", line)
  *exit
  DISK:[USER]JNI_EXAMPLE.COM;29 229 lines

  $

Obviously, the line with 'if f$locate("1.1.", line)' works/worked just accidently. :-(
And finally ...

  $ @jni_example
  Starting JNI_EXAMPLE
  Using java version:
  java version "1.6.0"
  Versions earlier than 1.1.8-5 or 1.2.2-1 will not be able to
  successfully call the native method example3proc_with_long_name.

  1. compiling example1.java
  2. generating header file example1.h
  3. compiling example1_nat.c (production)
  4. linking example1 (production)
  DISK:[USER]EXAMPLE1_NAT.OBJ;1
  %ILINK-W-COMPWARN, compilation warnings
          shareable image: SYS$COMMON:[JAVA$60.JRE.LIB.IA64]JAVA$JAVA_SHR.EXE;1
  5. defining a logical for the new shareable image
  6. running example1
     correct output is: 42
  You have reached example1proc, 
    with integer argument = 42 (0x2a)
  You have also reached My_Very_Own_Special_Procedure_With_A_Long_Name.
  You have reached example2proc 
     with input argument: Two Turtle Doves 
  You have reached example2proc 
     with input argument: Three French Hens 
  Returned from example2proc with: Four Calling Birds
  You have reached example3proc_with_long_name, 
    with integer argument = -3 (0xfffffffd)
  Repeating steps 3-6 for debug version of shareable
  NOTE: ***If the debug version of JAVA {JAVA$JAVA_G_DEBUG.EXE} and the matching
        ***debug versions of Java shareables were not installed,
        ***then steps 7-10 will be skipped.
  7. compiling example1_nat.c (debug)
  8. linking example1 (debug)
  DISK:[USER]EXAMPLE1_NAT.OBJ;2
  %ILINK-W-COMPWARN, compilation warnings
          shareable image: SYS$COMMON:[JAVA$60.JRE.LIB.IA64]JAVA$JAVA_G_SHR.EXE;1
  9. defining a logical for the new shareable image
  10. running example1 (debug)
  You have reached example1proc, 
    with integer argument = 42 (0x2a)
  You have also reached My_Very_Own_Special_Procedure_With_A_Long_Name.
  You have reached example2proc 
     with input argument: Two Turtle Doves 
  You have reached example2proc 
     with input argument: Three French Hens 
  Returned from example2proc with: Four Calling Birds
  You have reached example3proc_with_long_name, 
    with integer argument = -3 (0xfffffffd)
  11. purging output files
  $

Hmm, a linker warning about compiler warnings of code in the supplied JAVA$JAVA_G_SHR.EXE ???

OK, we have the example working. Although there is a "(debug)" printed, it doesn't seem to go into the VMS debugger, which is what we want/need and maybe expected, here.

  $ run example1_g

           OpenVMS I64 Debug64 Version V8.4-001

  %DEBUG-I-INITIAL, Language: C, Module: EXAMPLE1_NAT

  DBG> exit 
  $

This is what we want to debug and obviously there is debug information in this shareable image.

Now we run the debug version of java, set a break point at Java$dlopen, which loads the shareable images, and look for "our" jni, the example1_g. Admitted, you have to know, guess or find out the hard way, what the name of the load function is and in which Java (shareable) image it is located. This may be the most valuable info, here.

  $ def example1_g sys$disk:[]example1_g.exe
  $ mc sys$common:[java$60.bin]java$java_g_debug "example1

           OpenVMS I64 Debug64 Version V8.4-001

  %DEBUG-I-INITIAL, Language: C, Module: MAIN_JACKET
  %DEBUG-I-NOTATMAIN, Type GO to reach MAIN program

  DBG> set image JAVA$JAVA_VMS_G_SHR; set break Java$dlopen do (ex/asciz @r32)
  DBG> g
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_G_DEBUG
  break at routine MAIN_JACKET\main in THREAD 1
  %DEBUG-W-UNAOPNSRC, unable to open source file JR:[J2SE.SRC.SOLARIS.VMS.SRC]MAIN_JACKET.C;1
  -RMS-F-DEV, error in device name or inappropriate device type for operation
   47908: Source line not available
  DBG> g
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_VMS_G_SHR
  break at routine DL_JACKET\Java$dlopen in THREAD 1
  %DEBUG-W-UNAOPNSRC, unable to open source file JR:[J2SE.SRC.SOLARIS.VMS.SRC]DL_JACKET.C;1
  -RMS-F-DEV, error in device name or inappropriate device type for operation
   44641: Source line not available
  2060506856:     "/SYS$COMMON/JAVA$60/JRE/LIB/IA64/HOTSPOT/JAVA$HOTSPOT_G_SHR.EXE"
  DBG> g
  break at routine DL_JACKET\Java$dlopen in THREAD 2
   44641: Source line not available
  159275056:      "java$verify_g_shr"
  DBG> g
  %DEBUG-I-DYNIMGSET, setting image LIBRTL
  %DEBUG-I-DYNMODSET, setting module LIB$$READ_ELF
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_VMS_G_SHR
  break at routine DL_JACKET\Java$dlopen in THREAD 2
   44641: Source line not available
  159275056:      "java$java_g_shr"
  DBG> g
  %DEBUG-I-DYNIMGSET, setting image LIBRTL
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_VMS_G_SHR
  break at routine DL_JACKET\Java$dlopen in THREAD 2
   44641: Source line not available
  159274832:      "java$zip_g_shr"
  DBG> g
  %DEBUG-I-DYNIMGSET, setting image LIBRTL
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_VMS_G_SHR
  break at routine DL_JACKET\Java$dlopen in THREAD 2
   44641: Source line not available
  160991136:      "/java$zip_g_shr"
  DBG> g
  break at routine DL_JACKET\Java$dlopen in THREAD 2
   44641: Source line not available
  160991424:      "example1_g"
  DBG>

Next to be loaded is ours: let java load it, get rid of all the breakpoints so far and set one in the loaded image:

  DBG> step/ret
  %DEBUG-I-DYNIMGSET, setting image LIBRTL
  %DEBUG-I-DYNIMGSET, setting image JAVA$JAVA_VMS_G_SHR
  stepped on return from DL_JACKET\Java$dlopen\%LINE 44641 to DL_JACKET\Java$dlopen\%LINE 44764+17 in THREAD 2
   44764: Source line not available
  DBG> can break/all
  DBG> set image EXAMPLE1_G; set module EXAMPLE1_NAT; set break Java_example1_example1proc
  DBG> g
  %DEBUG-W-BADSTACK, WARNING: stack corrupted; session integrity not guaranteed
  break at routine EXAMPLE1_NAT\Java_example1_example1proc in THREAD 2
    4282:     printf ("You have reached example1proc, \n");

Here we are. The BADSTACK warning is nasty, but it seems to have no negative side effects. HP should fix this!

  DBG> Step
  You have reached example1proc, 
  %DEBUG-W-BADSTACK, WARNING: stack corrupted; session integrity not guaranteed
  stepped to EXAMPLE1_NAT\Java_example1_example1proc\%LINE 4283 in THREAD 2
    4283:     printf ("  with integer argument = %d (0x%x)\n", arg1, arg1);
  DBG> ex arg1
  %DEBUG-W-UNALLOCATED, 'arg1' is not allocated in memory (optimized away)

Hmm, so the "debug" version was not compiled with /NOOPTIMIZE (setting jni_verify=1 shows this, not really useful, but what can one expect from a free demo program anyway).

The argument arg1 is in r34:

  DBG> ex r34
  EXAMPLE1_NAT\Java_example1_example1proc\%R34:   42
  DBG> Step
    with integer argument = 42 (0x2a)
  %DEBUG-W-BADSTACK, WARNING: stack corrupted; session integrity not guaranteed
  stepped to EXAMPLE1_NAT\Java_example1_example1proc\%LINE 4274 in THREAD 2
    4274:   printf("You have also reached My_Very_Own_Special_Procedure_With_A_Long_Name.\n");

Looks fine to me, let's get out of the debugger and java ...

  DBG> exit
  %DEBUG-E-LASTCHANCE, stack exception handlers lost, re-initializing stack
  %DEBUG-W-BADSTACK, WARNING: stack corrupted; session integrity not guaranteed
  %CMA-F-EXIT_THREAD, current thread has been requested to exit
  break on unhandled exception preceding SHARE$PTHREAD$RTL_CODE2+146608 in THREAD 2
  %DEBUG-I-SOURCESCOPE, source lines not available for %PC in scope number 0 
          Displaying source for 8\%PC
    4283:     printf ("  with integer argument = %d (0x%x)\n", arg1, arg1);
  DBG> exit
$

More nasty warnings and even error messages: Hello, HP?