Thread: Storing BLOB from other machine

Storing BLOB from other machine

From
"S.A.Pamungkas"
Date:
I need to create a user interface that used to store
blob from other machine (internet).
My user interface is working good to store BLOB from
local machine (using large object API). BLOB retrieval
is also o.k from both local and remote machine.

I know that to store BLOB from remote machine, I
should use fastpath API. The problem is: I din't know
how to use fastpath API ? 

In which step the fastpath API should be added, if the
sceleton code that I used to store BLOB is as follow:
.....
class importer extends Thread
{  String code;  String filename;   /* filename is the file (path) for blob that will
be stored to database, for example 
/usr/local/image/image.jpg */
  Connection con;
  public importer(Connection con, String code, String
filename){    this.con = con;    this.code = code;    this.filename = filename;  }  public void run(){   if (code!=null
&&filename!=null){     Statement stat = null;          try{        LargeObjectManager
 
lom=((org.postgresql.Connection).getLargeObjectAPI();        con.setAutoCommit(false)        byte buf[] = new
byte[3000];       FileInputStream fis= new FileInputStream(new
 
File(fileOid));        int oid = lom.create();        LargeObject blob = lom.open(oid);                int s, t=0;
 while((s=fis.read(buf,0,buf.length))>0){          t += s;          blob.write(buf,0,s);         }        ......
 
Thank you.

S.A.Pamungkas      








__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/