我有 Shell 脚本,当我手动运行它时可以正确执行。但是我通过java程序运行shell脚本,shell程序运行,但它不更新表,也没有抛出错误。下面包含我的 shell 脚本的详细信息和指向 java 程序的链接。
外壳脚本-
echo "started the script execution"
echo "
BEGIN
update <<table_name>> set name='abc';
commit;
END;
/
"| sqlplus -s $MD_DB_USER_NAME/$MD_DB_PASS@$MD_DB_SERVER
echo "After executing the update statement"
我称之为 shell scipt 的 Java 程序:
http://www.codesandscripts.com/2014/10/java-program-to-execute-shell-scripts-on-remote-server.html。
我认为程序与数据库有连接。谁能告诉我它可能是什么
感谢您的上述回答。我对我的问题的回答如下-
在运行 shell 脚本之前,我正在加载一个配置文件,其中包含我所有的数据库详细信息等。所以它工作正常。但是当我通过java程序运行时,配置文件没有加载。因此,在我的 shell 脚本的第一行中,我必须添加源"配置文件路径"。现在它工作正常。