Dear all,

after having upgraded our kernel and database instances from version 7.3 to
7.4, we have run into problems inserting values into LONG columns. Assume
this table:

CREATE TABLE TBLTEST 
(
  "KEY"        INTEGER,
  "LONGVALUE"  LONG ASCII
)

The following insert worked as expected (one row inserted) in 7.3 (using the
SAPDB JDBC):

    Context ctx = null;
    ctx = (Context)new InitialContext().lookup("java:comp/env");
    DataSource Databaseds = (DataSource)ctx.lookup("jdbc/TESTDB");
    Connection conSAPDB = null;
    conSAPDB = Databaseds.getConnection();

    PreparedStatement localPreparedStmt = null;
    int result = -1;

    StringBuffer sbQuery = new StringBuffer();
    sbQuery.append("INSERT INTO TBLTEST VALUES ( ?, ? )");
    localPreparedStmt = conSAPDB.prepareStatement(sbQuery.toString());
    localPreparedStmt.setLong(1, 1);
    localPreparedStmt.setString(2, "Value");
    result = localPreparedStmt.executeUpdate();

However, the same statements executed against a 7.4. database instance fails
with message "SQLException:[-2010]: Assignment impossible, char value too
long". On the other hand, doing an update of a row in the same table still
works in both database versions (one row updated):

    StringBuffer sbQuery = new StringBuffer();
    sbQuery.append("UPDATE TBLTEST SET LONGVALUE = ? WHERE KEY = ?");
    localPreparedStmt = conSAPDB.prepareStatement(sbQuery.toString());
    localPreparedStmt.setString(1, "NewValue");
    localPreparedStmt.setLong(2, 1);
    result = localPreparedStmt.executeUpdate();

Is there a new way to set values for a LONG column to a prepared statement
that needs to be used for version 7.4, or am I missing something obvious?

Any insight appreciated!

Johan H
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to