Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scan a byte array

Status
Not open for further replies.

yanis97

Programmer
Jan 26, 2004
22
0
0
FR
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;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top