Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Problem executing a script using sqlplus from Groovy code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 40797
829
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic