Consultor Eletrônico



Kbase P111840: BLOB fields remain empty and are not being copied
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   22/12/2005
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.0B

SYMPTOM(s):

BLOB fields remain empty and are not being copied

Using INSERT INTO" function with embedded SELECT 'function'

CAUSE:

It's not supported by PSC to insert either BLOB(LVARBINARY) or CLOB(LVARCHAR) values statically without using PreparedStatement and set param calls. the values of either BLOB(LVARBINARY) or CLOB(LVARCHAR) columns can't be put directly into the insert or update sql statements for both ODBC and JDBC application.


FIX:

The PreparedStatement has to be used and where the "?" marks has to be specified for BLOB or CLOB insert values.
Following up the creation of such a PreparedStatement, setString(jdbc, both
blob and clob), setBinaryStrem(jdbc,blob) or setCharacterStream(jdbc,clob)
needs to be called to put the actual values in. Here is the correct
sequence:
1. java.sql.Connection connection = ...
2. PreparedStatement stmt = connection.prepareStatement("INSERT INTO

table(blob_col,clob_col) values (?,?)")
3. stmt.setString(1,".....");
4. stmt.setString(2,".....");
5. stmt.executeUpdate();
6. stmt.close(); " .