From: S.A.Pamungkas <moenk_2000@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: input large object from internet
Date: Mon, 18 Sep 2000 19:20:33 -0700 (PDT)
Message-ID: <20000919022033.11992.qmail@web4904.mail.yahoo.com> (raw)
Hi all
According imageviewer example, I made GUI ( by
applet-servlet ) for input data to DB, including blob.
Input data from localhost ( the same PC ) is ok. For
example, I could input image data by writing
"/usr/aji/home.gif" in my GUI.
My question : Is it possible to input blob from other
computer ( from ineternet ) ?
If YES, how to do that ? Which method should I use ?
This is my servlet skeleton code :
.............
String image_file = getImage_file(); // resulting
String "/usr/aji/home.gif"
.......
if(leccod!=null && teacod!=null && date!=null &&
viname!=null && image_file!=null && dept!=null)
{
Statement stat = null;
try
{
LargeObjectManager lom =
((org.postgresql.Connection)con).getLargeObjectAPI();
con.setAutoCommit(false);
byte buf[] = new byte[3000];
FileInputStream fis = new FileInputStream(new
File(image_file));
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)
}
blob.close();
stat = con.createStatement();
stat.executeUpdate("insert into images values('" +
leccod + "','" + teacod + "','" + date + "','" +
viname + "'," + oid + ",'" + dept + "')");
con.commit();
con.setAutoCommit(false);
..........
Any suugestion would be appreciate.
Thank you.
-pamungkas-
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.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: input large object from internet
In-Reply-To: <20000919022033.11992.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