running sqlplus from within Julia -


i'm beginner julia user use of projects.

many of projects require me make quick connection oracle id number of other data. can running sqlplus other programs shell or tcl, i've tried syntax in julia documentation, 1 error or another.

in tcl looks this

exec sqlplus -s user/pass@dbname << "             set pagesize 0 feedback off verify off heading off echo off             select id table1 name='abc';             exit;             " 

from julia, i'm trying use run command this

run(`sqlplus -s user/pass@dbname << "    set pagesize 0 feedback off verify off heading off echo off    select id table1 name='abc';    exit;    "    `) 

but various errors julia like

stacktrace: [1] depwarn(::string, ::symbol) @ ./deprecated.jl:70 [2] warn_shell_special(::string) @ ./shell.jl:8 [3] #shell_parse#236(::string, ::function, ::string, ::bool) @ ./shell.jl:103 [4] (::base.#kw##shell_parse)(::array{any,1}, ::base.#shell_parse, ::string, ::bool) @ ./<missing>:0 (repeats 2 times) [5] @cmd(::any) @ ./process.jl:796 [6] eval(::module, ::any) @ ./boot.jl:235 [7] eval_user_input(::any, ::base.repl.replbackend) @ ./repl.jl:66 [8] macro expansion @ ./repl.jl:97 [inlined] [9] (::base.repl.##1#2{base.repl.replbackend})() @ ./event.jl:73 

any anyone?

here function works on machine, returns output of sqlplus command in variable (if needed). if output not needed, simpler solution might available.

sqlplus_script = """    set pagesize 0 feedback off verify off heading off echo off    select id table1 name='abc';    exit; """  sqlplus_cmd = `sqlplus -s user/pass@dbname` # sqlplus_cmd = `cat`         # used testing  function stringpipe(cmd,instring)     inpipe = pipe()     outpipe = pipe()     p = spawn(pipeline(cmd,stdin=inpipe,stdout=outpipe))     write(inpipe, instring)     close(inpipe)     close(outpipe.in)     s = read(outpipe,string)     return s end  println(stringpipe(sqlplus_cmd, sqlplus_script)) 

it self-explanatory (btw using julia version 0.6 should work on 0.5).


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -