• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Invoking SQL Loader from Java

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a code snippet working in which I am invoking SQL Loader from Java. However, I would like to make the table name in the control file dynamic. Is there a way to set the table name to a variable in the control file and assign this variable a value outside of the control file within Java?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't find any information about variables in control file in the docs. However, given that you're running the whole thing from Java, you could easily create the control file for each run and stuff the required table name into it.

If your program can access to a file system your database server can see, you could also consider external tables. Generally, anything that can be processed using SQL Loader can be processed by external tables. The "loading" is then done using a SQL command (insert into your_target_table as select from external_table) which would clearly be fully under your control.
 
Ranch Hand
Posts: 34
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use ProcessBuilder class in Java to invoke any executable. So you can have your sqlldr command in a bat file, and invoke this bat file from Java.
 
Popeye has his spinach. I have this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic