DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Call SQL*Loader from VB

  1. #1
    Join Date
    May 2001
    Posts
    82

    Arrow


    I am not sure if I this is the right forum for this question, but I didn't know where else to post it.

    How do I invoke SQL*Loader with all the parameters (like control and log) from VB .

    Thank you.


  2. #2
    Join Date
    Mar 2001
    Posts
    635
    Hi

    I feel you can best create a batch file to Invoke sql*loaderr and define all the parameters on the OS like the control file,data file and call this batch file from VB.I think you can call a file from VB

    Regards
    Santosh

  3. #3
    Join Date
    Apr 2001
    Location
    Louisville KY
    Posts
    295
    You can have VB write the control file/parameter file(s) with the appropirate parms, then issue the shell("command line") command thru VB to execute .
    Joseph R.P. Maloney, CSP,CDP,CCP
    'The answer is 42'

  4. #4
    Join Date
    May 2001
    Posts
    82

    I tried the foll. command from VB:

    retval=shell("
    sqlldr userid=scott/tiger@optxdb control="C:\temp\testheader.ctl" log="C:\temp\testheader.log"")

    I even tried giving the path name for sqlldr like:

    retval=shell("C:\oracle\ora81\bin\sqlldr.exe .........rest of the parameters here) , but both these formats do not work.

    Thank you


  5. #5
    Join Date
    May 2001
    Posts
    82
    santoshym,

    I tried it your way by using the batch file. It works perfectly fine.

    But, I think there should be a way to call SQL*Loader from VB directly.

    Thank you.

  6. #6
    Join Date
    Aug 2000
    Posts
    462
    s_radhak:

    I have VB 5 professional, SP3 and personal Oracle 8.1.6. on my PC at home. I just started a new "Standard EXE" project in VB, added one button with the following code:

    Private Sub Command1_Click()
    Dim retval
    retval = Shell("c:\oradb\bin\sqlldr.exe userid=user/pwd@mydb control=c:\temp\testdat.ctl bad=c:\temp\testdat.bad log=c:\temp\testdat.log")
    End Sub

    I then clicked the button and the rows were inserted as expected.

    CONTROL FILE:

    load data
    infile "c:\temp\testdat.dat"
    into table loadtest
    fields terminated by ','
    (a,
    b)


    DATA FILE:

    "One","One"
    "Two","Two"

    What are you doing differently than this, and what exactly do you mean when you state:
    "but both these formats do not work."

    What doesn't work? What exactly happens? Do you see a momentary DOS window open? Does your log or bad file get populated?

  7. #7
    Join Date
    May 2001
    Posts
    82
    Kmesser:

    Thank you.
    I made a mistake of adding double quotes for the control and log files.
    It works now.
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width