Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem executing a script using sqlplus from Groovy code  RSS feed

 
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
Marshal
Posts: 36622
475
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!