This is a discussion on PreparedStatement within the DB2 forums, part of the Database Server Software category; --> Hallo zusammnen, ich möchte einen VARBINARY-Wert aus einer Tabelle auslesen, diesen in einer Datei speichern und später wieder in ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hallo zusammnen, ich möchte einen VARBINARY-Wert aus einer Tabelle auslesen, diesen in einer Datei speichern und später wieder in eine Tabelle einfügen. Den Wert hole ich mit einem Select und getString(). Das Ergebnis (z.B. 011b0148107f007310850069006e01671020205400550149) füge ich (nachdem ich es in einer Date gespeichert und später wieder ausgelesen habe) mit einem Insert-Statement und PreparedStatement folgendermaßen ein: String value = new String(); value = "011b0148107f007310850069006e01671020205400550149" ; byte[] varByte = value.getBytes(); pstmt.setBytes(j, varByte); Hier erhalte ich folgenden Fehler: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -954, SQLSTATE: 57011, SQLERRMC: null Was mache ich falsch? Wechen Unterschied gibt es beim setXXX für BINARY, VARBINARY, LONGVARBINARY? Danke & Grüße... Stefan |
| |||
| sorry, I should write in english: I like to read VARBINARY-field from a table , save this ín a file and write it then into another table. I read the field with a select-statement and getString(). The Result (like: 011b0148107f007310850069006e01671020205400550149) i will insert with PreparedStatement: String value = new String(); value = "011b0148107f007310850069006e01671020205400550149" ; byte[] varByte = value.getBytes(); pstmt.setBytes(j, varByte); At that point i will get this error: Hier erhalte ich folgenden Fehler: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -954, SQLSTATE: 57011, SQLERRMC: null What is wrong? What is the difference in the setXXX-Statement with BINARY, VARBINARY, LONGVARBINARY? thanx... stefan |
| |||
| sorry, I should write in english: I like to read VARBINARY-field from a table , save this ín a file and write it then into another table. I read the field with a select-statement and getString(). The Result (like: 011b0148107f007310850069006e01671020205400550149) i will insert with PreparedStatement: String value = new String(); value = "011b0148107f007310850069006e01671020205400550149" ; byte[] varByte = value.getBytes(); pstmt.setBytes(j, varByte); At that point i will get this error: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -954, SQLSTATE: 57011, SQLERRMC: null What is wrong? What is the difference in the setXXX-Statement with BINARY, VARBINARY, LONGVARBINARY? thanx... stefan |
| ||||
| info@daten-host.de wrote: > sorry, I should write in english: > > I like to read VARBINARY-field from a table , save this Ã*n a file and > write it then into another table. What's a VARBINARY? VARCHAR FOR BIT DATA or a BLOB? > I read the field with a select-statement and getString(). > The Result (like: 011b0148107f007310850069006e01671020205400550149) i First, what you're seeing there is the hexadecimal representation of the actual value, i.e. two of the digits together represent a single byte in the value. > will insert with PreparedStatement: > > String value = new String(); > value = "011b0148107f007310850069006e01671020205400550149" ; > byte[] varByte = value.getBytes(); > pstmt.setBytes(j, varByte); > > At that point i will get this error: > com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -954, SQLSTATE: > > 57011, SQLERRMC: null > > What is wrong? $ db2 "? sql0954" SQL0954C Not enough storage is available in the application heap to process the statement. Explanation: All available memory for the application has been used. The statement cannot be processed. User Response: Terminate the application on receipt of this message. Increase the database configuration parameter ( applheapsz ) to allow a larger application heap. sqlcode : -954 sqlstate : 57011 -- Knut Stolze DB2 Information Integration Development IBM Germany |