Bonjour;
J'ai une méthode qui me retourne un byte array d'un BLOB (Oracle) :
Je dois parcourir ce tableau position par poistion pour récupérer les données réelles contenus ds ce tableau.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 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(); } } }
Comment dois je procèder ?
Merci
Partager