• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem executing a script using sqlplus from Groovy code

 
Jack O'Neill
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been attempting without success to run a sql script via sqlplus with some Goovy code inside a Gradle script:

def sqlplusCmd = "sqlplus " + jdbc_user + "/" + jdbc_pass + " @load_ddl.sql".execute(null, new File(sql_db_dir))

The sql_db_dir variable contains the following path:

G:/projects/project1/test/sql/dbscripts/src/main/db

The above path definitely contains my sql file named , but I continue to get the following error on execution:


Cannot run program "@load_ddl.sql" (in directory "G:\projects\project1\test\sql\dbscripts\src\main\db"): CreateProcess error=2, The system cannot find the file specified

If I navigate to that exact path and run the same sqlplus command manually, the script executes.

Any thoughts as to what I'm missing or doing incorrectly?


Thanks.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36032
432
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. That looks right.

Can you try it from a different directory at the command line? That would tell you if sqlplus is getting the directory from you happening to bee in that directory rather than getting it from the variable.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!