Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用groovy.sql.Sql从 Groovy 运行 Oracle 脚本?我不认为将整个脚本读入字符串然后将其拆分为';' 分号字符将起作用,因为脚本中有'cursor'、'begin'、'for'和'if'语句末尾没有分号。因此,我相信我正在寻找一种通过 JDBC 驱动程序从 Groovy 运行脚本的方法。这甚至可能还是我需要使用“sqlplus”实用程序?
我相信最简单(可能也是唯一)的解决方案是调用sqlplus应用程序:
sqlplus
就像是:
def proc = "sqlplus $username/$password@$db $scriptFilename".execute() proc.consumeProcessOutput( System.out, System.err ) proc.waitFor()