Skip to Main Content

Developing / debugging SQLcl javascript in Netbeans

ptflMay 16 2018 — edited May 21 2018

Apologies if this is too unrelated to SQLcl.

I have been attempting to set up Netbeans on Windows 7 to develop SQLcl javascript scrips to take advantage of the ability to debug the code (Netbeans 8.2; SQLcl 18.1.1).

I did my best to follow the instructions at these two links, and I have this working, 'sort of'.

Initially, I was able to get 'util' and 'sqlcl' functions / methods to work, but the code would fail with the below error when trying to do a 'myConnection.ctx.write("Any value in here \n");'


Exception in thread "main" java.lang.NullPointerException

at oracle.dbtools.raptor.newscriptrunner.ScriptRunnerContext.write(

While trolling through Google for anything that might help, I happened on a page that seemed somewhat unrelated that suggested putting these lines ahead of the attempt to myConnection.ctx.write():

myConnection.sqlcl.setStmt("set encoding UTF-8");;

And this worked -- suddenly my 'myConnection.ctx.write()' calls are not generating an error and are appearing in the output...EXCEPT...

...if I execute an sqlcl call that returns rows, it appears no subsequent attempts to execute 'myConnection.ctx.write()' calls will put anything into the output. e.g., from the example:

myConnection.sqlcl.setStmt("select table_name from user_tables where rownum < 4; \n");;

From those lines onward, no attempt to write output via the myConnection.ctx object will be visible.

I can't find anywhere if this is a known problem, and I also am not sure where (or if) this functionality in Netbeans is being maintained, since I don't experience this problem when I run the same code through SQLcl.

Appreciate any suggestions of who / where to ask.

Post Details
Added on May 16 2018