In order to store XML Documents in an Oracle database (as XMLType
columns) you might want to consider using a typeCallBackHandler:
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Type+Handler+Callbacks
[EMAIL PROTECTED] wrote:
When I was working with Oracle and needed to store XML documents in
the database I defined the column type as LONG RAW. Then I was able to
stream the data into the table by using the following:
PreparedStatement statement =
connection.prepareStatement("insert into DOCUMENTSTORE values(?,?)");
ByteArrayInputStream stream = new
ByteArrayInputStream(documentData);
statement.setBinaryStream(1, stream, documentData.length);
To get the data out of the table I used the following:
connection = this.getConnection();
statement = connection.prepareStatement("select DOCUMENT from
DOCUMENTSTORE where ID = ?");
statement.setObject(1, primaryKey);
byte[] documentData = null;
ResultSet result = statement.executeQuery();
if (result.next()) {
documentData = result.getBytes(1);
}
------------------------------------------------------------------------
*From:* soussou97 <[EMAIL PROTECTED]> [mailto:soussou97
<[EMAIL PROTECTED]>]
*Sent:* Friday, September 29, 2006 5:16 AM
*To:* [email protected]
*Subject:* Scanning byte array
Hi;
I have a method which return a byte array from a BLOB (Oracle) :
public static byte[] getBLOB(int id, Connection conn) throws Exception {
ResultSet rs = null;
PreparedStatement pstmt = null;
String query = "SELECT data FROM Table1 WHERE id = ?";
try {
pstmt = conn.prepareStatement(query);
pstmt.setInt(1, id);
rs = pstmt.executeQuery();
rs.next();
Blob blob = rs.getBlob(1);
return blob.getBytes(1, (int) blob.length());
} finally {
rs.close();
pstmt.close();
conn.close();
}
}
}
I must to scan the byte array position by position for extracting of the
data contained into this array for a display in using a GUI.
Which is the best (performance) solution to implemente this ?
Regards;
--
View this message in context:
http://www.nabble.com/Scanning-byte-array-tf2356548.html#a6563833
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
--
Cumquat Information Technology
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)30 - 6940499
http://www.cumquat.nl
[EMAIL PROTECTED]
M +31 6 51 169 556