Friday, 4 December 2009

Having SQL*Plus run within Jdeveloper's Log window

Invoking SQL*Plus is what I do a lot from JDeveloper, so there are 2 things I setup everytime I do a fresh install of JDeveloper.

1. Use external tools to avoid having to enter password as per this blog entry a while ago.

http://theblasfrompas.blogspot.com/2007/10/avoiding-having-to-enter-password-when.html

2. Secondly I now only use sqlplus.exe rather then sqlplusw.exe to ensure that it never leaves JDeveloper itself and so the output is redirected to JDeveloper's log window. Of course you have to then add "exit" to your scripts so that the process itself doesn't hang around.

Also it's worth making sure you start from the directory of the SQL file your invoking if you wish to include other files as part of the SQL script itself which don't reference a path themselves.

Eg:

Program Executable: D:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe
Arguments: scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=beast.au.oracle.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=linux11g))) @${file.path}
Run Directory: ${file.dir}

Demo output as follows showing how I invoke SQL*Plus and what we pass into it to avoid opening up a new window for SQL*Plus.

No comments: