Solved

DB2 Lob Locator Problem

Posted on 2002-05-04
5
1,563 Views
Last Modified: 2007-11-27
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.DatabaseException
EXCEPTION DESCRIPTION: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0423N Locator va
riable "1" does not currently represent any value. SQLSTATE=0F001

INTERNAL EXCEPTION: COM.ibm.db2.jdbc.DB2Exception: [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.DatabaseException.sqlException(DatabaseException.java:221)
at TOPLink.Private.Helper.ConversionManager.convertObjectToByteArray(ConversionManager.java:
212)
at TOPLink.Private.Helper.ConversionManager.convertObject(ConversionManager.java:81)
at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject(DatabasePlatform.java:594)
at TOPLink.Public.Mappings.SerializedObjectMapping.getAttributeValue(SerializedObjectMapping
.java:43)
at TOPLink.Public.Mappings.DirectToFieldMapping.valueFromRow(DirectToFieldMapping.java:474)
at TOPLink.Public.Mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:808)
at TOPLink.Private.Descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:16
8)
at TOPLink.Private.Descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:320)
at TOPLink.Private.Descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:368)
at TOPLink.Public.QueryFramework.ReadAllQuery.execute(ReadAllQuery.java:368)
at TOPLink.Public.QueryFramework.DatabaseQuery.execute(DatabaseQuery.java:394)
at TOPLink.Public.QueryFramework.ReadQuery.execute(ReadQuery.java:99)
at TOPLink.Public.PublicInterface.Session.internalExecuteQuery(Session.java:1628)
at TOPLink.Public.ThreeTier.ServerSession.internalExecuteQuery(ServerSession.java:543)
at TOPLink.Public.PublicInterface.Session.executeQuery(Session.java:921)
at TOPLink.Private.Indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:
45)
at TOPLink.Private.Indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.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.

0
Comment
Question by:iamsenthil
5 Comments
 
LVL 7

Accepted Solution

by:
waynezhu earned 500 total points
ID: 6990265
Senthil,

If you visit
"http://www-106.ibm.com/developerworks/java/jdk/" and
"http://www-106.ibm.com/developerworks/java/jdk/other/oldercode.html",
you will see, the available JDK versions (except on AIX)
are 1.1.x and 1.3.x. Also, it states
"We STRONGLY encourage developers to migrate to Java 2 version 1.3 as soon as possible, ...".

Other people may encounter similar problems as yours.
See this one:
"http://groups.google.com/groups?q=SQL0423N&hl=en&ie=UTF8&oe=UTF8&selm=95q0pb%24672%241%40news.chorus.net&rnum=1" where the JDK/JDBC 1.2 was used
same as what you have used.

Does IBM support JDK 1.2? If yes, call IBM for a fix. If
not, use IBM supported version instead.

Good Luck.

Wayne

PS. BTW, toplink 4.0 requires JDK 1.2 or above.
Does toplink 3.6 have the same requirement?
0
 

Expert Comment

by:georgherdt
ID: 7294837
Hi senthill,
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 from security.test where
 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.


 
0
 

Expert Comment

by:modulo
ID: 7426576
Dear: georgherdt

I've rejected your proposed answer as Experts Exchange holds an experiment to work without the answer button.

See:        http://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
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question