πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.databases
4 messages
4 total messages Started by BigJef Sun, 23 Mar 2003 17:15
Inserting a BLOB into an Oracle BLOB field.
#20
Author: BigJef
Date: Sun, 23 Mar 2003 17:15
13 lines
1560 bytes
Hi,

How can I insert a new record in an Oracle table with a BLOB field. I'm
especially interessed in the way to get a BLOB into this field using JDBC.

We use Oracle 8.1.7.

Tnx in advance,


Kind regards,

BigJef
Re: Inserting a BLOB into an Oracle BLOB field.
#21
Author: Kristof Meirlaen
Date: Mon, 24 Mar 2003 06:51
20 lines
1902 bytes
On Sun, 23 Mar 2003 17:15:19 GMT, "BigJef" <tmp-05@pandora.be> wrote:

>Hi,
>
>How can I insert a new record in an Oracle table with a BLOB field. I'm
>especially interessed in the way to get a BLOB into this field using JDBC.
>
>We use Oracle 8.1.7.

You don't describe your problem, but here is a tip:
Use the 'thik' drivers.  I think that the thin client for 8.1.7 does
not support BLOB data.

Hope it helps,
Kristof Meirlaen

--
Is your server up? Are you sure?
Monitor your servers:
http://www.kri-soft.be/servermonitor/
Re: Inserting a BLOB into an Oracle BLOB field.
#22
Author: Olivier Jousselin
Date: Mon, 24 Mar 2003 14:16
26 lines
2264 bytes
On Sun, 23 Mar 2003 18:15:19 +0100, BigJef wrote:

> How can I insert a new record in an Oracle table with a BLOB field

	Well, I had all kind of trouble to reach that aim. Even today, this is
not pure JDBC, but it's the closer I could manage. My solution is along
these lines :

	- create the item with a null BLOB field
	- "select blobField from myTable for update"
	- get a java.sql.Blob with rs.getBlob (1);
	- get an OutputStream with
		((oracle.sql.BLOB)myBlob).getBinaryOutputStream ();
	- then write in it.

	JDBC-wise (ie, on non-Oracle databases), I use a prepared statement based
on "update myTable set blobField = ?", on which I invoke
setBinaryStream (1, myStream, size); Oracle (8.1.6 here) does nothing
with this construct, alas ... Works perfectly with all other DMBSes I tested
(CachοΏ½, PostgreSQL, Informix, DB2)

	One advantage of this solution : it works with the thin drivers.

	HTH. Feel free to contact me for more info if you wish.
-- 
_Olivier_
Re: Inserting a BLOB into an Oracle BLOB field.
#23
Author: Sudsy
Date: Mon, 24 Mar 2003 15:34
19 lines
1700 bytes
"BigJef" <tmp-05@pandora.be> wrote in message news:<HYlfa.3434$t_2.317@afrodite.telenet-ops.be>...
> Hi,
> 
> How can I insert a new record in an Oracle table with a BLOB field. I'm
> especially interessed in the way to get a BLOB into this field using JDBC.
> 
> We use Oracle 8.1.7.
> 
> Tnx in advance,
> 
> 
> Kind regards,
> 
> BigJef

It's convoluted. Go to www.sudsy.net, click on the Technology
button and select the article title "Using CLOBs with Oracle".
The information also applies to BLOBs. This is distilled from
the documentation provided directly by Oracle, BTW.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads