D
Daniel Berger
Hi all,
Is it possible to drive Oracle's sqlplus (command line utility) with =
open3?=20
Don't ask me why, just nod your head and accept it please.
I seem to be able to connect and send sql, but I'm having trouble =
grabbing output:
# Attempt to interact with the sql shell
require 'open3'
cmd =3D 'user@database'
pass =3D 'xxxx'
sql =3D 'select sysdate from dual;'
Open3.popen3(cmd) do |stdin, stdout, stderr|
puts "Sending password..."
stdin.puts(pass)
puts "Sending sql..."
stdin.puts(sql)
# Hangs here
puts "Getting results"
uresults =3D stdout.read
puts "Results: #{results}"
puts "Quitting..."
stdin.puts('quit')
end
I tried wrapping the read method in its own Thread, but I couldn't make =
it=20
work. Tinkering with various sync options didn't help, though perhaps I =
set=20
them incorrectly.
Any ideas?
Thanks,
Dan
This communication is the property of Qwest and may contain confidential =
or
privileged information. Unauthorized use of this communication is =
strictly=20
prohibited and may be unlawful. If you have received this communication =
in error, please immediately notify the sender by reply e-mail and =
destroy=20
all copies of the communication and any attachments.
Is it possible to drive Oracle's sqlplus (command line utility) with =
open3?=20
Don't ask me why, just nod your head and accept it please.
I seem to be able to connect and send sql, but I'm having trouble =
grabbing output:
# Attempt to interact with the sql shell
require 'open3'
cmd =3D 'user@database'
pass =3D 'xxxx'
sql =3D 'select sysdate from dual;'
Open3.popen3(cmd) do |stdin, stdout, stderr|
puts "Sending password..."
stdin.puts(pass)
puts "Sending sql..."
stdin.puts(sql)
# Hangs here
puts "Getting results"
uresults =3D stdout.read
puts "Results: #{results}"
puts "Quitting..."
stdin.puts('quit')
end
I tried wrapping the read method in its own Thread, but I couldn't make =
it=20
work. Tinkering with various sync options didn't help, though perhaps I =
set=20
them incorrectly.
Any ideas?
Thanks,
Dan
This communication is the property of Qwest and may contain confidential =
or
privileged information. Unauthorized use of this communication is =
strictly=20
prohibited and may be unlawful. If you have received this communication =
in error, please immediately notify the sender by reply e-mail and =
destroy=20
all copies of the communication and any attachments.