in reply to File upload to Oracle database using perl

The fact that you're dealing with an Oracle database is really neither here nor there, except that you'll probably be storing the data in a column on type BLOB. This can be handled pretty much transparently with DBI.

When you talk of "uploading", I assume you mean a web form. If the site in question is inside a corporate LAN, the most efficient use of programmer time (what efficiency were we talking about again?) will be to use CGI to handle the decoding of the POST or GET data correctly.

You also want to prepare the SQL insert statement and use placeholders: if the query is hit with any regularity the optimiser will pull the previous query plan out of the library cache. This probably won't change the program efficiency one whit (because network latency is going to be your biggest problem by an order of magnitude), but it's a good habit to get into, and will serve you well in the future.

When all is said and done, you can probably do this in about 10 lines of simple code in Perl. If you have any particular questions on how to put it all together, don't hesitate to ask, if you get stuck on a some aspect of the problem.

Hell, given a page with a file upload input widget named 'upload', it would probably look something like (warning: untested code ahead):

use strict; use warnings; use CGI; use DBI; my $q = CGI->new; my $db = DBI->connect( ... ); # see DBD::Oracle for details END { $db and $db->disconnect }; my $insert = $db->prepare( <<END_SQL ) or die $db->errstr; insert into tabname (colname) values (?) END_SQL if (defined(my $data = $q->param('upload'))) { $insert->execute($data) or die $insert->errstr; }

By default, DBI will do commits automatically. You would be wise to turn this off, and do an explicit commit if everything goes according to plan, otherwise rollback. That is left as an exercise to the reader.

• another intruder with the mooring in the heart of the Perl