Is it possible to store Java objects in DB2 V8.2 for Windows/Unix/Linux via
JDBC?
Specifically, if I have a 4-dimensional boolean array, i.e. boolean[][][][],
can I store it directly in a column of a DB2 table? If so, how do I do it?
It would be VERY convenient if I could store this boolean array directly in
a column of a DB2 table but I'm not at all clear on whether this is
possible, even after reading the documentation in the Information Center. I
was intrigued by the setObject() and getObject() methods in JDBC but I'm not
at all sure if I can use them for the purpose I described. I'm especially
unlclear about what datatype the column containing the Object could/should
be.
If I can't store a multidimensional boolean array directly in a table
column, I can always convert it into a representation of the array that uses
more traditional datatypes. For instance, I could convert:
boolean[] myArray = {true, false, true};
into this String:
String myString = "TFT"; //T=true; F=false
then store the String representation of the array in one of the CHAR column
types. But it would be much more convenient if I could simply store the
boolean[][][][] array directly in a column of the table. Does anyone know if
that is possible? If it is, a brief code snippet showing how to insert the
value would be VERY helpful!
--
Rhino