Lesen von bytes als string aus der Db

Ich habe eine Tabelle mit 2 Feldern ein(container_id) für einen numerischen Typ, und eine andere für byte-Typ(coDearntainer_objects) .
Ich würde gerne Lesen das byte-Feld(container_objects) als Zeichenfolge für die entsprechenden (container_id)
Feld.

Wie könnte ich dies tun? Ich bin mit Postgresql Db
Tisch Struktur:

CREATE TABLE container
(
  ct_id numeric,
  container_object bytea
)
  • String sql="select container_objects von contanier, wo ct_id=232"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(baos); Vector scontObject=new Vector(); scontObject.add("container_objects"); oout.writeObject(scontObject); System.aus.println(oout.toString()); //System.aus.println(baos.toString()); oout.close(); } ich habe versucht, wie diese bekam ich Folgendes Ergebnis java.io.ObjectOutputStream@efd552
InformationsquelleAutor Mohan | 2010-09-22
Schreibe einen Kommentar