I am trying to use JDBC in the JuliaPro IDE, but it doesn’t seem to release the JMV from memory when the destroy() method is called. If I run the following code twice, then I get an error, but shouldn’t it work if destroy() released the JVM from memory?
Code:
using JDBC
JDBC.init()
JDBC.destroy()
Error:
ERROR: LoadError: JavaCall.JavaCallError("Unable to initialise Java VM: -1")
Stacktrace:
[1] init(::OrderedCollections.OrderedSet{String}) at C:\Users\dburch\.juliapro\JuliaPro_v1.0.5-2\packages\JavaCall\0wJQZ\src\jvm.jl:180
[2] init() at C:\Users\dburch\.juliapro\JuliaPro_v1.0.5-2\packages\JavaCall\0wJQZ\src\jvm.jl:156
[3] init() at C:\Users\dburch\.juliapro\JuliaPro_v1.0.5-2\packages\JDBC\2ruzk\src\JDBC.jl:40
[4] top-level scope at none:0
in expression starting at untitled-101b06be47b56380518cb53da02cdcaa:2
Yeah, the JNI unload does not work correctly. I thought I had documented this somewhere, but can’t find it now.
This is one of the reasons why the init is not called by default on module load – the user needs to call it explicitly. This allows you to set the required classpath before the JVM loads, since once loaded, you cannot unload it till the process restarts.
Does this mean it won’t be possible to use two different drivers at the same time? I was trying to connect through JDBC to both a MySQL and Oracle databases (using two different JDBC drivers). I am able to use JDBC to connect independently, but connecting to both has proved to be fruitless so far.