import os from subprocess import Popen,PIPE sqlplus = Popen(["sqlplus", "-S", "andy/root"], stdout=PIPE, stdin=PIPE) sqlplus.stdin.write("select sysdate from dual;"+os.linesep) sqlplus.stdin.write("insert into t_python values(1,'chenlong');"+os.linesep) sqlplus.stdin.write("insert into t_python values(2,'xiao');"+os.linesep) sqlplus.stdin.write("select count(*) from t_python;"+os.linesep) sqlplus0.stdin.write("select count(*) from emp;"+os.linesep) out, err = sqlplus.communicate() print out sqlplus0 = Popen(["sqlplus", "-S", "scott/root"], stdout=PIPE, stdin=PIPE) out0, err0 = sqlplus0.communicate() print out0
python+sqlplus
原创
©著作权归作者所有:来自51CTO博客作者ether007的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章