Oci: executing <script_name>.sql script

Hi,
I have a locally running oracle thin client installation that I use to
successfully to connect to a remote, on a virtual machine, oracle
instance.
I also wrote a ruby script, using the oci8 gem, to connect to the
database and run a select statement to get the content of a table.
Also, on the remote host I have some sql script which I run:

su - oracle
sqlplus <user_name>/<password>
<SQL> @<script_name>

In my ruby script I tried the following:
con = OCI8.new(’<user_name>’, ‘’, ‘//<host_ip>:/XE’)
con.exec(‘select name from actor’) do |records|
puts records
end

The above statement worked correctly printing each column,row of the
actor table.

I then tried the following
con.exec(’@<script_name>’)

However, this did not work, got the following error:
stmt.c:230:in oci8lib_200.bundle: ORA-00900: invalid SQL statement
(OCIError)

Any idea what statement I need to use to execute that sql script on the
remote host?
Thanks

Roland W. wrote in post #1166730:

su - oracle
sqlplus <user_name>/<password>
<SQL> @<script_name>

I then tried the following
con.exec(‘@<script_name>’)

That trick works only in SQLPlus.

However, this did not work, got the following error:
stmt.c:230:in oci8lib_200.bundle: ORA-00900: invalid SQL statement
(OCIError)

Any idea what statement I need to use to execute that sql script on the
remote host?

  1. hit: Execute script in remote server - Oracle Forums

Was that so difficult?