iamsenthil
asked on
DB2 Lob Locator Problem
Hi,
We are connecting to DB2 database using TopLink3.6. We have the following table with blob columns.
CREATE TABLE Table1 (
col1 DECIMAL(10) NOT NULL,
blob1 BLOB(164000),
col2 DECIMAL(10) NOT NULL,
blob2 BLOB(164000)
)
This works fine with JDBC Level 1 driver. But, while using JDBC Level 2 driver, We are getting the following exception;
EXCEPTION [TOPLINK-4002] (3.6 JDK1.2): TOPLink.Public.Exceptions. DatabaseEx ception
EXCEPTION DESCRIPTION: COM.ibm.db2.jdbc.DB2Except ion: [IBM][CLI Driver][DB2/NT] SQL0423N Locator va
riable "1" does not currently represent any value. SQLSTATE=0F001
INTERNAL EXCEPTION: COM.ibm.db2.jdbc.DB2Except ion: [IBM][CLI Driver][DB2/NT] SQL0423N Locator varia
ble "1" does not currently represent any value. SQLSTATE=0F001
ERROR CODE: -423
at TOPLink.Public.Exceptions. DatabaseEx ception.sq lException (DatabaseE xception.j ava:221)
at TOPLink.Private.Helper.Con versionMan ager.conve rtObjectTo ByteArray( Conversion Manager.ja va:
212)
at TOPLink.Private.Helper.Con versionMan ager.conve rtObject(C onversionM anager.jav a:81)
at TOPLink.Private.DatabaseAc cess.Datab asePlatfor m.convertO bject(Data basePlatfo rm.java:59 4)
at TOPLink.Public.Mappings.Se rializedOb jectMappin g.getAttri buteValue( Serialized ObjectMapp ing
.java:43)
at TOPLink.Public.Mappings.Di rectToFiel dMapping.v alueFromRo w(DirectTo FieldMappi ng.java:47 4)
at TOPLink.Public.Mappings.Da tabaseMapp ing.readFr omRowIntoO bject(Data baseMappin g.java:808 )
at TOPLink.Private.Descriptor s.ObjectBu ilder.buil dAttribute sIntoObjec t(ObjectBu ilder.java :16
8)
at TOPLink.Private.Descriptor s.ObjectBu ilder.buil dObject(Ob jectBuilde r.java:320 )
at TOPLink.Private.Descriptor s.ObjectBu ilder.buil dObjectsIn to(ObjectB uilder.jav a:368)
at TOPLink.Public.QueryFramew ork.ReadAl lQuery.exe cute(ReadA llQuery.ja va:368)
at TOPLink.Public.QueryFramew ork.Databa seQuery.ex ecute(Data baseQuery. java:394)
at TOPLink.Public.QueryFramew ork.ReadQu ery.execut e(ReadQuer y.java:99)
at TOPLink.Public.PublicInter face.Sessi on.interna lExecuteQu ery(Sessio n.java:162 8)
at TOPLink.Public.ThreeTier.S erverSessi on.interna lExecuteQu ery(Server Session.ja va:543)
at TOPLink.Public.PublicInter face.Sessi on.execute Query(Sess ion.java:9 21)
at TOPLink.Private.Indirectio n.QueryBas edValueHol der.instan tiate(Quer yBasedValu eHolder.ja va:
45)
at TOPLink.Private.Indirectio n.Database ValueHolde r.getValue (DatabaseV alueHolder .java:62)
at TLTable1.toString(Unknown Source)
I used the Blob.getBlob() in my sample application to get that table data and that retrieves fine(ie, without using toplink) ..
have anybody faced this already or someone has an answer for it.
Thanks in advance for the help!!
-Senthil.
We are connecting to DB2 database using TopLink3.6. We have the following table with blob columns.
CREATE TABLE Table1 (
col1 DECIMAL(10) NOT NULL,
blob1 BLOB(164000),
col2 DECIMAL(10) NOT NULL,
blob2 BLOB(164000)
)
This works fine with JDBC Level 1 driver. But, while using JDBC Level 2 driver, We are getting the following exception;
EXCEPTION [TOPLINK-4002] (3.6 JDK1.2): TOPLink.Public.Exceptions.
EXCEPTION DESCRIPTION: COM.ibm.db2.jdbc.DB2Except
riable "1" does not currently represent any value. SQLSTATE=0F001
INTERNAL EXCEPTION: COM.ibm.db2.jdbc.DB2Except
ble "1" does not currently represent any value. SQLSTATE=0F001
ERROR CODE: -423
at TOPLink.Public.Exceptions.
at TOPLink.Private.Helper.Con
212)
at TOPLink.Private.Helper.Con
at TOPLink.Private.DatabaseAc
at TOPLink.Public.Mappings.Se
.java:43)
at TOPLink.Public.Mappings.Di
at TOPLink.Public.Mappings.Da
at TOPLink.Private.Descriptor
8)
at TOPLink.Private.Descriptor
at TOPLink.Private.Descriptor
at TOPLink.Public.QueryFramew
at TOPLink.Public.QueryFramew
at TOPLink.Public.QueryFramew
at TOPLink.Public.PublicInter
at TOPLink.Public.ThreeTier.S
at TOPLink.Public.PublicInter
at TOPLink.Private.Indirectio
45)
at TOPLink.Private.Indirectio
at TLTable1.toString(Unknown Source)
I used the Blob.getBlob() in my sample application to get that table data and that retrieves fine(ie, without using toplink) ..
have anybody faced this already or someone has an answer for it.
Thanks in advance for the help!!
-Senthil.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dear: georgherdt
I've rejected your proposed answer as Experts Exchange holds an experiment to work without the answer button.
See: https://www.experts-exchange.com/jsp/communityNews.jsp
Paragraph: Site Update for Wednesday, November 06, 2002
By this rejection the Asker will be notified by mail and hopefully he will take his responsibility to finalize the question or post an additional comment.
The Asker sees a button beside every post which says "Accept This Comment As Answer" (including rejected answers) -- so if he/she thinks yours is the best, you'll be awarded the points and the grade.
Thanks !
modulo
Community Support Moderator
Experts Exchange
I've rejected your proposed answer as Experts Exchange holds an experiment to work without the answer button.
See: https://www.experts-exchange.com/jsp/communityNews.jsp
Paragraph: Site Update for Wednesday, November 06, 2002
By this rejection the Asker will be notified by mail and hopefully he will take his responsibility to finalize the question or post an additional comment.
The Asker sees a button beside every post which says "Accept This Comment As Answer" (including rejected answers) -- so if he/she thinks yours is the best, you'll be awarded the points and the grade.
Thanks !
modulo
Community Support Moderator
Experts Exchange
if you still have this Problem there are two things you
should do for solving.
1.) Upgrade your DB2 installation to Fixpak 7, you can download this from the IBM website.
http://www-3.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/v7fphist.d2w/report#WINDOWS
2.) check your code for the correct usage of the jdbc API.
What I mean is check youre Code for lines like these:
Statement stmt;
.... blah get my statement from connection ....
stmt.executeQuery("delete from security.test where smb=0");
instead you should write:
stmt.executeUpdate("delete
smb=0");
The same thing you should do for PreparedStatements.
Whenever you use insert or update use executeUpdate(..) .
In most cases the code above works, but it seems as this
kind of usage has some sideeffect to the following queries.