Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: virus-check incoming blob

Re: virus-check incoming blob

From: Maximus <qweqwe_at_qwqwewq.com>
Date: Sat, 26 Jul 2003 00:45:32 GMT
Message-ID: <MakUa.517442$ro6.12089147@news2.calgary.shaw.ca>


"Dan." <dan_at_nospam.edu> wrote in message news:bfrtpl$heq$1_at_news.Stanford.EDU...
> Has anyone implemented a virus-checking feature when inserting a file into
a
> BLOB column? If so, could you please reply with a general overview of how
> to implement it?
>
> Thanks in advance for any insights on this! -Dan

One solution, scan it first with a command line utility before inserting it and automate the process with java. Basically, write a java function that calls the virus scan utility with the necessary parameters, interpret the result, then insert/reject/flag the file accordingly. I haven't used this method for virus scans but I for processing images stored in blobs with ImageMagick. Bascially, write the blob containing an image out to a temp file somewhere, call a java function that in turn interfaces with the command-line utilities for scaling, labelling, etc, then when done update the blob. The java you need will look something like this code snippet:

String result;
Process p;
File f = File.createTempFile("data",null); // create temporary file for blob data

// need some code here to copy the blob to the file and save it.

String[] args0 =
{

    "/usr/bin/X11/mogrify", // the full path of the utility you want to call

    "-compress",     // some parameters
    "RunlengthEncoded",
    "-format",
    "jpeg",

    f.getPath() // the path to the temp file };

// spawn the process

p = Runtime.getRuntime().exec(args0);
p.waitFor(); // wait for it to finish
if(p.exitValue()!=0) result+="false"; // interpret the return value

... insert the processed file back into the database

Works like a charm. Received on Fri Jul 25 2003 - 19:45:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US