Hi friends,
I want to populate an oracle table with values from a CSV file using
java could some body briefly explain me the procedure please.
Thanks,
Samanth.
check and open an jdbc oracle connection , you need the oracle libraries from
their web site.
turn OFF auto commit.
open a file stream to get you CSV values in.
read a line in from your file.
split the line down at the commas, and stick into an array. (1 line at a
time)
use an oracle prepared statement , and bind variables.
bind each variable in a single row of your array to the oracle statement.
execute the statement.
go back to your file for more values.
then repeat the procedure.
finally when your file is finished AND there have been no errors issue an
oracle commit.
if there were any errors, issue an oracle rollback.
close your oracle connection.
close your file
exit.
OR if you are using oracle 9i/10 g, and you have access to the database you
can link the flat CSV file DIRECTLY to a table.
by using a dummy table. so that the database accesses the flat file , but
gives the appearance it is a table.
Steve