Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002

    Unanswered: DB2 Lob Locator Problem

    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: [IBM][CLI Driver][DB2/NT] SQL0423N Locator va
    riable "1" does not currently represent any value. SQLSTATE=0F001

    INTERNAL EXCEPTION: [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.sqlExc eption(
    at TOPLink.Private.Helper.ConversionManager.convertOb jectToByteArray(
    at TOPLink.Private.Helper.ConversionManager.convertOb ject(
    at nvertObject(
    at tAttributeValue(SerializedObjectMapping
    at TOPLink.Public.Mappings.DirectToFieldMapping.value FromRow(
    at TOPLink.Public.Mappings.DatabaseMapping.readFromRo wIntoObject(
    at TOPLink.Private.Descriptors.ObjectBuilder.buildAtt ributesIntoObject(
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObj ect(
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObj ectsInto(
    at TOPLink.Public.QueryFramework.ReadAllQuery.execute (
    at TOPLink.Public.QueryFramework.DatabaseQuery.execut e(
    at TOPLink.Public.QueryFramework.ReadQuery.execute(Re
    at TOPLink.Public.PublicInterface.Session.internalExe cuteQuery(
    at TOPLink.Public.ThreeTier.ServerSession.internalExe cuteQuery(
    at TOPLink.Public.PublicInterface.Session.executeQuer y(
    at TOPLink.Private.Indirection.QueryBasedValueHolder. instantiate(
    at tValue(
    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!!


  2. #2
    Join Date
    Jul 2002


    I think this problem has nothing to do with toplink or the jdbc driver version. I get the same error message in my application as soon as the blob value is a greater than some value ( i don't know the limit ). I searched for a lot of days all db2 sites for help -> nothing but this thread in whole internet about reading blob values with java.

    All examples from ibm one of the 2 possible code fragments :
    ResultSet.getBinaryStream(...) or

    both ideas do not work as soon the data to be read is to large, so i think, that there is a buffer overflow with large blob objects or the curser get closed to soon ?!?

    Have you found any work around or found a solution for your problem so far ?

    Here is a code fragment of my implementation:
    public Vector getObjectBlob(String sql, int column_number, String column_name, int MAX)
    throws java.sql.SQLException, {
    Vector result=new Vector();
    // create Statement object
    Statement stmt = con.createStatement();

    // create a ResultSet object by executing query
    ResultSet rs = stmt.executeQuery(sql);

    // create ResultMetaData object to verify target column's SQL datatype
    ResultSetMetaData rsmd;

    while ( {
    Blob blobObj=null;
    Object obj=null;
    if (column_name!=null)
    // here the exception is thrown!
    blobObj = rs.getBlob(column_name);
    blobObj = rs.getBlob(column_number);

    if (blobObj == null) {
    System.err.println("no blob value found");
    } else {
    // Retrieve meta data for the result set
    rsmd = rs.getMetaData();
    System.out.println("reading from type "+rsmd.getColumnTypeName(1));
    byte[] buffer = new byte[MAX];

    InputStream is = blobObj.getBinaryStream();;
    File tmp=File.createTempFile("ObjectBlob",".tmp");
    FileOutputStream out=new FileOutputStream(tmp);
    ObjectInputStream in=new ObjectInputStream(new FileInputStream(tmp));
    try {
    } catch (Exception e) {
    System.err.println("No Object found in Blob value");
    return result;

    Please notify me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts