Hi
We are porting Oracle database to DB2 v8.1.

While updating CLOB data type field,exception arises in calling setstring method to write String to CLOB object retrieved from ResultSet.

The detail error message is as below :

java.lang.AbstractMethodError: COM.ibm.db2.jdbc.net.DB2Clob.setString(JLjava/lang/String


oclob.setString((long)iclobpos,String.copyValueOf( dst));



Below is the Code snippet ---::::

public boolean UpdateClobData(Connection argConn , String argTableName, String argPrimaryKeyName,
int primarykeyid , int modelid ,HashMap map)
{
try
{
boolean bCommitFlag =true;
if (map.size()>0)
{
Iterator it = map.keySet().iterator();
while (it.hasNext())
{
String columnname = (String)it.next();
String argClobText = (String)map.get(columnname);
if (argClobText.trim().length() == 0)
continue;

PreparedStatement oPreparedStatement = null;
Statement oDB2Statement = null;
try
{
String sClobSelectQuery = " SELECT SQL;

String sClobUpdateQuery = " UPDATE SQL = ?"

//Update Operation
oPreparedStatement = (PreparedStatement) argConn.prepareStatement(sClobUpdateQuery) ;
oDB2Statement = argConn.createStatement() ;

if (oDB2Statement != null)
{
ResultSet oDB2ResultSet = oDB2Statement.executeQuery(sClobSelectQuery) ;
if (oDB2ResultSet != null)
{
Clob oclob = null;
while (oDB2ResultSet.next())
oclob = oDB2ResultSet.getClob(1);
if ( oclob != null)
{
StringBuffer sb = new StringBuffer(argClobText);
int ilength = argClobText.length();
int iBufferPos = 0;
int ichunkSize = 2048;
int iclobpos = 1;
int icounter = 0;

char []dst = null;
while (ilength > 0)
{
if (ilength < ichunkSize)
{
dst = new char[ilength] ;
sb.getChars(iBufferPos,iBufferPos+ilength ,dst,0);
}
else
{
dst = new char[ichunkSize] ;
sb.getChars(iBufferPos,iBufferPos+ichunkSize ,dst,0);
icounter++;
}

oclob.setString((long)iclobpos,String.copyValueOf( dst));

iBufferPos = iBufferPos + ichunkSize;
iclobpos = iclobpos + ichunkSize;
ilength = ilength - ichunkSize;
}
oPreparedStatement.setClob(1,(Clob)oclob);
oPreparedStatement.execute();
}
else
{
bCommitFlag = false ;
}
oDB2ResultSet.close();
}
else
{
bCommitFlag = false ;
}
oPreparedStatement.close();
oDB2Statement.close();
}
else
{
bCommitFlag = false ;
}
} catch(Exception e)
{
e.printStackTrace();
return false ;
}
}
}
return bCommitFlag ;
} catch(Exception e)
{
e.printStackTrace();
return false ;
}

}

Do I require any specific settings at database end or elsewhere to update CLOB.

Looking for you kind help.

Regards,
Raj Shekhar