Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > DB2 > DB2 VARGRAPHIC problem?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-01-02, 06:37
suresh_cm suresh_cm is offline
Registered User
 
Join Date: Jan 2002
Location: India
Posts: 1
Question DB2 VARGRAPHIC problem?

Hi,

I am developing an internationalized Java application which uses DB2 UDB version 7.2 unicode database. The database is created using codeset UTF-8 and JDBC 2.0 is used to connect the application to the database. I've the following table:


CREATE REGULAR TABLESPACE TsStmtDefn
MANAGED BY DATABASE
USING (FILE 'd:\bgsampledb2\TsStmtDefn' 257)
EXTENTSIZE 16 PREFETCHSIZE 2 ;

CREATE LONG TABLESPACE TsStmtDefnBlob
MANAGED BY DATABASE
USING (FILE 'd:\bgsampledb2\TsStmtDefnBlob' 513)
EXTENTSIZE 48 PREFETCHSIZE 4 ;

CREATE TABLE bgadmin.definition
(
id CHAR(8) FOR BIT DATA NOT NULL,
name VARGRAPHIC(50) NOT NULL,
definitionblob BLOB(500K) COMPACT
)
IN TsStmtDefn
LONG IN TsStmtDefnBlob;

CREATE UNIQUE INDEX ix1_definition
ON bgadmin.definition (
id ASC
);

CREATE UNIQUE INDEX ix2_definition
ON bgadmin.definition (
name ASC
);

ALTER TABLE bgadmin.definition
ADD CONSTRAINT p_definition PRIMARY KEY (id);


As clear from the script, I am using a VARGRAPHIC field to hold unicode graphic character data. Now the problem is that when I try to insert or update a record into the table, I am getting the following error:


SQL USED:
---------
INSERT INTO DEFINITION ( ID, NAME, DEFINITIONBLOB ) VALUES ( ?, ?, ? )
>>>input values: [[B@7e83bb1a][iBillerDef][[B@4b567b1b]

ERROR:
------
[IBM][CLI Driver][DB2/6000] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006
>>>executed with error: [IBM][CLI Driver][DB2/6000] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006


The error does not occur if I use a VARCHAR field instead of VARGRAPHIC field. Also, the insert/update operation entry is working fine without a BLOB field. It looks like there is a problem with an insert/update operation in DB2 unicode databse when a VARGRAPHIC and BLOB fields occur together in a table. Can somebody help me in figuring out a solution for this ?

Best regards,
Suresh.
Reply With Quote
  #2 (permalink)  
Old 03-21-03, 14:56
esjp2000 esjp2000 is offline
Registered User
 
Join Date: Mar 2003
Posts: 1
Post Re: DB2 VARGRAPHIC problem?

Hi, Suresh

I have the same problem, did u find the solution for this? If yes, please let me know asap because I am working in a project, the time period to finish that project is very less. Can you please let me know how u solved the problem?

Thanks
Prakash



Quote:
Originally posted by suresh_cm
Hi,

I am developing an internationalized Java application which uses DB2 UDB version 7.2 unicode database. The database is created using codeset UTF-8 and JDBC 2.0 is used to connect the application to the database. I've the following table:


CREATE REGULAR TABLESPACE TsStmtDefn
MANAGED BY DATABASE
USING (FILE 'd:\bgsampledb2\TsStmtDefn' 257)
EXTENTSIZE 16 PREFETCHSIZE 2 ;

CREATE LONG TABLESPACE TsStmtDefnBlob
MANAGED BY DATABASE
USING (FILE 'd:\bgsampledb2\TsStmtDefnBlob' 513)
EXTENTSIZE 48 PREFETCHSIZE 4 ;

CREATE TABLE bgadmin.definition
(
id CHAR(8) FOR BIT DATA NOT NULL,
name VARGRAPHIC(50) NOT NULL,
definitionblob BLOB(500K) COMPACT
)
IN TsStmtDefn
LONG IN TsStmtDefnBlob;

CREATE UNIQUE INDEX ix1_definition
ON bgadmin.definition (
id ASC
);

CREATE UNIQUE INDEX ix2_definition
ON bgadmin.definition (
name ASC
);

ALTER TABLE bgadmin.definition
ADD CONSTRAINT p_definition PRIMARY KEY (id);


As clear from the script, I am using a VARGRAPHIC field to hold unicode graphic character data. Now the problem is that when I try to insert or update a record into the table, I am getting the following error:


SQL USED:
---------
INSERT INTO DEFINITION ( ID, NAME, DEFINITIONBLOB ) VALUES ( ?, ?, ? )
>>>input values: [[B@7e83bb1a][iBillerDef][[B@4b567b1b]

ERROR:
------
[IBM][CLI Driver][DB2/6000] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006
>>>executed with error: [IBM][CLI Driver][DB2/6000] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006


The error does not occur if I use a VARCHAR field instead of VARGRAPHIC field. Also, the insert/update operation entry is working fine without a BLOB field. It looks like there is a problem with an insert/update operation in DB2 unicode databse when a VARGRAPHIC and BLOB fields occur together in a table. Can somebody help me in figuring out a solution for this ?

Best regards,
Suresh.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On