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.
Printable View
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.
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
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 .
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
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.
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?
Kmesser:
Thank you.
I made a mistake of adding double quotes for the control and log files.
It works now.
Thank you.