Unix Technical Forum

PreparedStatement

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 ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:11 AM
info@daten-host.de
 
Posts: n/a
Default PreparedStatement

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:11 AM
info@daten-host.de
 
Posts: n/a
Default Re: PreparedStatement

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 08:11 AM
info@daten-host.de
 
Posts: n/a
Default Re: PreparedStatement

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 08:16 AM
Knut Stolze
 
Posts: n/a
Default Re: PreparedStatement

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:37 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com