Re: OAS + JServlets + BLOBS

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Wed, 12 Apr 2000 16:02:54 GMT
Message-ID: <38F49E6B.9B9A275_at_rationalconcepts.com>


Hello,
  I've used the thin driver to insert and retrieve a blob from a db table.

  From your steps,
  insert the empty blob into the table,

  // Needed to get by the ORA 1002
  turn autocommit off (con.setAutoCommit(false))

  get your data into shape to stream in.   do a select yourblob from yourtable FOR UPDATE

  get the handle of the BLOB
  get the output stream of the handle.
  write to the stream.

hth.
cindy

Hyper B Orean wrote:

> Andreas
>
> We are having the same type of problem with writing CLOBS in OAS 4.0.8.1 on
> NT with a Jservlet. We can *read* CLOB from database OK but can't write the
> CLOB .. we get error message saying to effect, we didn't lock the table
> before writing the CLOB data. This appears to only occur if we try to
> commit or close the transaction, or flush or close the output or input
> streams to the LOB.
>
> Oracle support previsouly told us to use the oci jdbc driver but we've
> never made this successfully work; the oci8 driver can't seem to find the
> TNSNAMES.ORA even tho' we've added the necesarry entry to the registry etc,
> and OAS (plus SQLPLUS etc) itself can see the entry in the TNSNAMES.ORA.
> But, Oracle support said that the thin driver wouldn't support reading
> either which is untrue, as it seems to work ok.
>
> CLOBs and BLOBs are quite different from handling VARCHARs and other data
> types; to write you have to insert table with empty clob and then retrieve
> a handle (the clob pointer) and then get its outputstream and stream the
> bytes into this outputstream. well at least in theory; because this is
> where we have the problem with the complaining about the record locking.
> have you looked at the examples in the Oracle 8i Java developer's Guide
> (found on technet)? I am going to get our DBA to tell us more about record
> locking tomorrow, in case there's some SQL we can use to overcome the
> problem; otherwise if you have had success these past two weeks since you
> posted your message please do share. ;-)
>
> regs
> hbo
>
> Andreas Geppert <geppert_at_ifi.unizh.ch> wrote in message
> news:38E45363.91AE8DA1_at_ifi.unizh.ch...
> > Has anybody experience in writing (and running!) Jservlets reading lobs
> > (blobs) from an
> > Oracle8 database via OAS (on Solaris)? We have tried to do that in a
> > servlet, but it seems
> > that Oracle's JDBC-driver can't handle blobs (or even long varchars).
> > Apparently, the
> > servlet never makes it beyond the executeQuery-call.
> >
> > Any help is highly appreciated!
> > --Andy
> >
> > -----------------------------------------------------------
> > Andreas Geppert
> >
> > Email: geppert_at_ifi.unizh.ch or geppert_at_acm.org
> > Web: http://www.ifi.unizh.ch/~geppert/
> > Phone: +41-1-635 4576
> > Fax: +41-1-635 6809
> > Mail: Institut f. Informatik
> > Universitaet Zuerich
> > Winterthurerstr. 190
> > CH-8057 Zuerich
> > Switzerland
> > -----------------------------------------------------------
> >
> >
Received on Wed Apr 12 2000 - 18:02:54 CEST

Original text of this message