Archive: Run .SQL Scripts on a Remote Computer, How?


Run .SQL Scripts on a Remote Computer, How?
Hi all,

I want to install "Oracle Related Tables" on a System that contains Oracle. (These "Oracle Related Tables" will be used in my Web Application later).

So, to install "Oracle Related Tables" I have several .SQL Files which I can call through "sqlplus @sample.sql". Its easy going when SQLPLUS.EXE is located in my System. I can just write

ExecWait "sqlplus scott/tiger
@MyDirectory/MySQLFile.sql"


MyDirectory is the name of the directory that is present in the same directory where my EXE is present. i.e.$EXEDIR. and this directory contains all my .SQL Files.


But, what if, Oracle is not in my System and it is on some other system (say 192.168.20.20) and I want to install my "Oracle Related Tables" on that System?


The above code will say "SQLPLUS.EXE not Found" obviously. I need to make this work on Remote Computer. Something like

ExecWait "\\192.168.20.20 sqlplus scott/tiger @MyDirectory/MySQLFile.sql" (This wont work ofcourse and I need something similar to this that executes my .SQL File using SQLPLUS of 192.168.20.20. i.e. I want to install Tables on Remote Oracle).


Please help me......


I also tried this:

ExecWait "telnet 192.168.20.20"

This opens telnet window and upon entering UserName and password, it will remote login and shows DOS Window "C:\". From here I want to install Tables. How? Even I want to make entering userName and password automatic i.e. from ExecWait. Is my using of Telnet COMPULSARY to install Tables on Remote Oracle? Or is there any other alternative?


You could write a batch file on run time (or just extract one to $PLUGINSDIR) and execute it with nsExec::Exec
nsExec::Exec will hide the window.

So, something along the lines of...
telnet 192.168.20.20
sqlplus scott/tiger "@MyDirectory/MySQLFile.sql"

-Stu