From: | "S(dot)A(dot)Pamungkas" <moenk_2000(at)yahoo(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Storing BLOB from other machine |
Date: | 2000-12-13 04:00:48 |
Message-ID: | 20001213040048.13887.qmail@web4904.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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/
From | Date | Subject | |
---|---|---|---|
Next Message | Bob Kline | 2000-12-13 04:09:34 | Re: your mail |
Previous Message | Lamar Owen | 2000-12-12 22:10:30 | Testing newsgroup posting for Marc. :-) |