Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: BLOB slow writing, fast reading??
The code looks good. I like to use buffers on 1024 byte boundaries(e.g.
8192).
I'd recheck your Oracle configuration. We've got a good DBA and BLOB
performance
is important to us. Here's the kind of numbers I'm seeing with 8i, NT, and
the Oracle 8.1.6
OCI8 JDBC drivers on 100 Mb LAN & code that looks alot like yours:
Reading 90KB < 1 sec. (almost instantanous) Writing 90KB ~ 2.5 sec.
Previous tests using 8.1.5 drivers:
Reading 10MB, 11.5 sec. (sorry no writing benchmarks)
My point is that I doubt its your code. Try optimizing your Oracle for
better BLOB performance.
Does your DB server have enough memory / swap ? My DB server is a PII 233
w/256 MB.
Frederik Hansen <roirex_at_post1.tele.dk> wrote in message
news:38194464.391EDB3E_at_post1.tele.dk...
> Hi
>
> Can anyone tell me why it takes about 20 minutes til write 0.5MB to a
> BLOB field, where reading from a BLOB field with 0.5MB only takes 20
> seconds???
>
> This is my writing code (using Java2, and classes12.zip)
>
> oracle.sql.BLOB blob =
> ((oracle.jdbc.driver.OracleResultSet)resl).getBLOB(1);
> OutputStream out = blob.getBinaryOutputStream();
> ByteArrayInputStream in = new ByteArrayInputStream(designFile.file);
> byte[] file = new byte[8000];
>
> int read = 0;
> while ( (read = in.read(file, 0, file.length)) != -1 )
> out.write(file, 0, read);
> out.close();
>
>
>
> And this is my read code :
>
>
> oracle.sql.BLOB blob =
> ((oracle.jdbc.driver.OracleResultSet)resl).getBLOB(1);
>
> BufferedInputStream in = new
> BufferedInputStream(blob.getBinaryStream());
> ByteArrayOutputStream out = new ByteArrayOutputStream();
>
> byte[] file = new byte[8000];
>
> int read = 0;
> while ((read = in.read(file, 0, file.length)) > 0)
> out.write(file, 0, read);
> in.close();
>
>
> --
> Venlig hilsen
> Frederik
Received on Fri Oct 29 1999 - 08:51:33 CDT
![]() |
![]() |