> > Hi friends,
> > I want to populate an oracle table with values from a CSV file using
[quoted text clipped - 21 lines]
> go back to your file for more values.
> then repeat the procedure.
this is OK, but there is probably a much better way.
> finally when your file is finished AND there have been no errors issue an
> oracle commit.
[quoted text clipped - 10 lines]
> by using a dummy table. so that the database accesses the flat file , but
> gives the appearance it is a table.
This sounds much better. The ORACLE product probably has an "import"
or "load data" or "link data" feature like the above described.
Assuming it does, why not just use it. Then the java coding would be
simple .. something like
statement . executeUpdate ( "LOAD DATA 'mycsvfile.csv' INTO TABLE
myoracletable FIELDS SEPARATED BY ',' LINES SEPARATED BY '\n' ;" ) ;
//PSEUCODE...I don't know the actual Oracle syntax
The OP should consult his/her Oracle documentation.
> Steve
steve - 14 Oct 2006 23:13 GMT
>>> Hi friends,
>>> I want to populate an oracle table with values from a CSV file using
[quoted text clipped - 50 lines]
>>
>> Steve
He said he wanted to use java, he may also want to range check.
and just for the record.
loading directly into the server , can only be done from the server, whereas
my method works from a client.
Greg R. Broderick - 15 Oct 2006 01:25 GMT
>> 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.
[quoted text clipped - 10 lines]
> //PSEUCODE...I don't know the actual Oracle syntax
> The OP should consult his/her Oracle documentation.
Better?
Doing the data load into a table using Java/JDBC has at least a chance that
the code will work with not only Oracle, but also with other database
products.
Doing the data load into a table using Java/JDBC is significantly more effort
- this effort is justified if the application is going to need to load
similar data into the table on an ongoing basis.
Doing the data load into a table using Oracle-specific functionality abandons
all hope for cross-platform compatibility.
Doing the data load into the table using Oracle-specific functionality
requires significantly less up-front effort, is probably better if the user
only needs to load the data into the table once or a few times.
So which is better? Depends on your perspective.
Cheers!

Signature
---------------------------------------------------------------------
Greg R. Broderick gregb.usenet200609@blackholio.dyndns.org
A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
Furious George - 15 Oct 2006 06:41 GMT
> >> 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.
[quoted text clipped - 29 lines]
>
> So which is better? Depends on your perspective.
Very true. In general, I prefer to avoid doing programming work if
someone else has already done it. Why reinvent the wheel? OTH - like
you said - this approach abandons hope for cross-platform
compatibility.
I just hope the OP takes the Java/JDBC approach and packages his/her
effort as an open-source file importing program. Then the next time, I
need to load data from a file, I'll just say why reinvent the wheel or
lose cross-platform compatibility...I'll just use the OP's program.
> Cheers!
>
[quoted text clipped - 5 lines]
> Q. What is the most annoying thing on Usenet?
> ---------------------------------------------------------------------