Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2006

Tip: Looking for answers? Try searching our database.

PreparedStatement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
info@daten-host.de - 30 May 2006 19:17 GMT
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
info@daten-host.de - 30 May 2006 19:23 GMT
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
info@daten-host.de - 30 May 2006 19:23 GMT
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
Knut Stolze - 06 Jun 2006 09:39 GMT
> 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:
>
[quoted text clipped - 9 lines]
>
> 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

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.