I'm using Storable against an Oracle DB with good success. It takes some finagling but it works reliably and it's surprisingly fast (in fact we're using it as a caching mechanism on our Web server).
Last I checked, DBD::Oracle didn't support binary large objects, or BLOBS, only characters (CLOBS). So, we have to turn our object into hex and write it out to the table.
#Freeze the object
my $data = eval { unpack ('h*', Storable::nfreeze($object))} ;
# ORACLE SPECIFIC
# create a hash containing specifying to Oracle what
# sort of data it will need to store. 112 is the value
# for a CLOB, 113 is the value for a BLOB.
# FIXME: make this a BLOB when DBD::Oracle supports that
my %hash = (ora_types => 112, ora_field => 'data');
# END ORACLE
# insert our values into the table
my $query = "INSERT INTO $table (jobID, data) VALUES ('$jid','$data')"
+;
$db_handle->execute($query, \%hash);
# To thaw (after retrieving from the DB)
my $object = eval { Storable::thaw(pack('h*',$data)) }
This may not be the best for your situation, especially since others have suggested off the shelf solutions that appear to address your needs, but this approach does work.
Update: perrin++. I came up with this scheme in early '00, and at that time BLOBS weren't implemented, or at least not in the version of DBD::Oracle we were using. I guess now I can go back and fix the FIXME's :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.