• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic