Storing/retrieving BLOBs with JSPs

R

Ryan Stewart

I am in extremely urgent need (by tomorrow) of a way to store files in and
retrieve files from an Oracle database using TopLink as an intermediary. I
have the JSPs for it, and it works for small files, but larger ones like
Word documents and Excel Spreadsheets give an error saying that the data is
too large for the field. Can anyone help with this? Our file object has a
fileData field which is an array of bytes which is mapped in TopLink to the
BLOB field of the database. As I said, it works for very small files like a
small GIF image, but with larger ones, I believe the error number is 17002,
a database error. I'm sorry I don't have any more details, but I don't have
access to the project at the moment. Any solutions/help/nudges in the right
direction are greatly appreciated
 
G

Guest

Hello,

it seem´s like an error because the file-size. with jdbc there is a
max-size to instert with jdbc (original oracle-jdbc driver). if you
inserted a file was greater if fails and generate an error. i didn´t now
at the moment, but i think the size is like 4M or 4K or so.

see for more information metalink!

best regards
thorsten häs
 
A

Andrew Thompson

Ryan Stewart said:
I am in extremely urgent need (by tomorrow)

As it happens, I don't care - you are not
paying me enough.

And in future, please do not cross-post
so widely. You are not that important,
trust me.
..of a way to store files in and
retrieve files from an Oracle database using TopLink as an intermediary. I
have the JSPs for it,

Good for you. Just how do you expect
others to debug them for you? Telepathy?
..and it works for small files, but larger ones like
Word documents and Excel Spreadsheets give an error saying that the data is
too large for the field.

What field?
..Can anyone help with this?

The only thing this absolute server-side noob
can suggest to somebody that does not supply
code, for free, is..

Maybe you are 'getting' the data rather than
posting it. ..but..
..Our file object has a
fileData field which is an array of bytes which is mapped in TopLink to the
BLOB field of the database. As I said, it works for very small files like a
small GIF image, but with larger ones, I believe the error number is 17002,
a database error.

That number sounds too large, I thought 'get's were
limited to much smaller sizes than that.
..I'm sorry I don't have any more details, but I don't have
access to the project at the moment.

See first comment.
..Any solutions/help/nudges in the right
direction are greatly appreciated

The ones I have to give, you've got..
 
S

Sudsy

Ryan said:
I am in extremely urgent need (by tomorrow) of a way to store files in and
retrieve files from an Oracle database using TopLink as an intermediary. I
have the JSPs for it, and it works for small files, but larger ones like
Word documents and Excel Spreadsheets give an error saying that the data is
too large for the field. Can anyone help with this? Our file object has a
fileData field which is an array of bytes which is mapped in TopLink to the
BLOB field of the database. As I said, it works for very small files like a
small GIF image, but with larger ones, I believe the error number is 17002,
a database error. I'm sorry I don't have any more details, but I don't have
access to the project at the moment. Any solutions/help/nudges in the right
direction are greatly appreciated

The solution is hardly trivial and having TopLink in the middle might
complicate the issue. As someone else noted, SQL inserts limit you to
4000 characters. You actually have to modify the table structure so
that your column of interest has a type of blob and a default value of
EMPTY_BLOB(). You then need to use the Oracle classes (not the generic
java.sql ones) to retrieve the reference to a BLOB (note capital-
ization). If that doesn't get you far enough down the road then I've
got some source code I'd be willing to let you see in exchange for a
few greenbacks.
 
M

moose

[snip]
As it happens, I don't care - you are not
paying me enough.

And in future, please do not cross-post
so widely. You are not that important,
trust me.

[snip]


Good for you. Just how do you expect
others to debug them for you? Telepathy?

Geez, could you be any more of a jackass?


[snip]
The ones I have to give, you've got..

After all that you can't even help.
And in future, please do not post if
you can't help. You are not that important,
trust me.
 
T

Thomas Schodt

and it works for small files,
but larger ones ... give an
error saying that the data is too large for the field.
Any solutions/help/nudges in the right
direction are greatly appreciated

As a workaround store big files as several slices of 4k (or whatever the
limit is) (maybe in a new table - with a slice-# as part of the key) and
reassemble them at retrieval time.
 
A

Andrew Thompson

moose said:
"Andrew Thompson" <[email protected]> wrote in message
[snip]

As it happens, I don't care - you are not
paying me enough.

And in future, please do not cross-post
so widely. You are not that important,
trust me.

[snip]


Good for you. Just how do you expect
others to debug them for you? Telepathy?

Geez, could you be any more of a jackass?


[snip]
The ones I have to give, you've got..

After all that you can't even help.

Did you miss..
"Maybe you are 'getting' the data rather than
posting it. ..but.."
[ As it turns out, I was completely wrong. ]
And in future, please do not post if
you can't help. You are not that important,
trust me.

:)

So let's sum this up.

I offered the OP 1 (albeit wrong) suggestion
23 hrs prior to a deadline that lay (presumedly)
within 24 hrs.

You offered the OP the above (which I did not
trim a character of), that is, nothing at all - some
120+ hours past the deadline.

That would seem to make you as useful as
an udder on a male moose, no?
 
M

moose

Funny, your math doesn't add up.
I never critisized the OP or offered any help to the OP.
That was YOU, in your astounding arrogance.

I stand by my first statement regarding your behavior.
What a jackass!
 
B

bigbinc

This is cool stuff, Is there anyway to implement a sort of Network
File System using Oracle using blobs. The question is, will this kill
the oracle server?
Will the performance being in better using File I/O for example using
servlets?

I would like to try it but I hate to mess up our server for doing so.
Are there any benchmarks?
 
M

Michael Borgwardt

bigbinc said:
This is cool stuff,

"Really idiotic" is the expression I'd use.
Is there anyway to implement a sort of Network
File System using Oracle using blobs. The question is, will this kill
the oracle server?

If used even halfway intensively, yes.
Will the performance being in better using File I/O for example using
servlets?

Yes. A LOT better. Easily 100 times better. It's exactly the thing that
modern file systems try so hard to prevent and CS teaches you to avoid like
the plague: fragment big files into small chunks and scatter them all over
the place so that the HD's latency completely dominates its transfer speed.
 
R

Ryan Stewart

*made bottom post*
Thomas Schodt <news0310@xenoc.$DEMON.co.uk> wrote in message
This is cool stuff, Is there anyway to implement a sort of Network
File System using Oracle using blobs. The question is, will this kill
the oracle server?
Will the performance being in better using File I/O for example using
servlets?

I would like to try it but I hate to mess up our server for doing so.
Are there any benchmarks?

That's pretty much what I was/am doing: making a file-sharing system. We
managed to get around the 4k limit by bypassing certain things and manually
inserting the file data into the database.
 
B

bigbinc

Michael Borgwardt said:
"Really idiotic" is the expression I'd use.

You are kidding me right, A filesystem is basically a database full
of file nodes.

If you are dealing in a one OS, one machine fine, standard file access
is great. If you are dealing with heterogenous networks, where NFS
is not available, then a Databased filesystem may in fact be the only
way to go.

See oracle internet filesystem.

http://otn.oracle.com/documentation/ifs_arch.html

Plus the fact, where is your data and performance stats, as you very
well know to say an approach in the computer industry is completely
idiotic, is idiotic.
 
R

Ryan Stewart

bigbinc said:
Michael Borgwardt <[email protected]> wrote in message

You are kidding me right, A filesystem is basically a database full
of file nodes.

If you are dealing in a one OS, one machine fine, standard file access
is great. If you are dealing with heterogenous networks, where NFS
is not available, then a Databased filesystem may in fact be the only
way to go.

See oracle internet filesystem.

http://otn.oracle.com/documentation/ifs_arch.html

Plus the fact, where is your data and performance stats, as you very
well know to say an approach in the computer industry is completely
idiotic, is idiotic.

I think what he was referring to was the idea of breaking the files into
tiny chunks. Essentially, that would be purposely fragmenting the database.
And with a maximum fragment size of 4k, that would be really bad.
 
B

bigbinc

Ryan Stewart said:
I think what he was referring to was the idea of breaking the files into
tiny chunks. Essentially, that would be purposely fragmenting the database.
And with a maximum fragment size of 4k, that would be really bad.


of course, sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top