From: S.A.Pamungkas <moenk_2000@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: Storing BLOB from other machine
Date: Tue, 12 Dec 2000 20:00:48 -0800 (PST)
Message-ID: <20001213040048.13887.qmail@web4904.mail.yahoo.com> (raw)
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: moenk_2000@yahoo.com
Subject: Re: Storing BLOB from other machine
In-Reply-To: <20001213040048.13887.qmail@web4904.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox