Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • SQLDataSource: Invalid column index while updating a blob column

    SmartClient Version: v11.1p_2018-09-07/Enterprise Deployment (built 2018-09-07)
    and
    SmartClient Version: SNAPSHOT_v12.1d_2018-09-10/EVAL Deployment (expires 2018.11.09_07.15.29) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

    Tomcat 8.5 and Oracle 12g

    Hello, I've got a table which has only one blob column. In my SQLDataSource I've got that field declared and also another which is based on the same blob field, using a customSelectExpression.
    I use it to show two different columns in a grid, one with showFileInline:true and another with showFileInline:false.

    Code:
    ....
            <field name="LOGO_IMG" type="imageFile"/>
            <field name="LOGO_IMG_FILENAME" type="text"/>
            <field name="LOGO_IMG_FILESIZE" type="integer"/>
            <field name="LOGO_IMG_DATE_CREATED" type="datetime"/>
    
            <field name="LOGO_IMG_FIELD" customSelectExpression="LOGO_IMG" type="imageFile"/>
            <field name="LOGO_IMG_FIELD_FILENAME" customSelectExpression="LOGO_IMG_FILENAME" type="text"/>
            <field name="LOGO_IMG_FIELD_FILESIZE" customSelectExpression="LOGO_IMG_FILESIZE" type="integer"/>
            <field name="LOGO_IMG_FIELD_DATE_CREATED" customSelectExpression="LOGO_IMG_DATE_CREATED" type="datetime"/>
    ....
    when trying to update a record with a new image, I got a SQL error:

    Code:
    2018-09-14 12:11:57,531 DEBUG DSRequest [builtinApplication.null] freeOnExecute is false for request of type fetch on DataSource LEG_SQUADRE - not freeing resources! 
    2018-09-14 12:11:57,532 INFO  SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD since it has a customSelectExpression or customSQLExpression but no customUpdateExpression 
    2018-09-14 12:11:57,532 INFO  SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_DATE_CREATED since it has a customSelectExpression or customSQLExpression but no customUpdateExpression 
    2018-09-14 12:11:57,532 INFO  SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_FILENAME since it has a customSelectExpression or customSQLExpression but no customUpdateExpression 
    2018-09-14 12:11:57,532 INFO  SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_FILESIZE since it has a customSelectExpression or customSQLExpression but no customUpdateExpression 
    2018-09-14 12:11:57,532 INFO  SQLDriver [builtinApplication.null] Executing SQL query on 'dbJpcEP' using connection '232188457': UPDATE DBSALES.LEG_SQUADRE SET CODICE_SQUADRA='MN', DESCRIZIONE='AS Monaco FC', FK_REGIONE=22, LOGO_IMG=?, LOGO_IMG_DATE_CREATED=TO_DATE('2018-09-14 12:11:57','YYYY-MM-DD HH24:MI:SS'), LOGO_IMG_FILENAME='MN.png', LOGO_IMG_FILESIZE=8595, LOGO_URL_PREFIX='https://custom-apps.juventus.com/static/images/loghi_squadre/', LOGO_URL_SUFFIX='.png', SERVER_PATH='smb://srvprodilb/static/images/loghi_squadre/' WHERE (LEG_SQUADRE.ID_REC=975393) 
    2018-09-14 12:11:57,537 DEBUG SQLDriver [builtinApplication.null] FAILED to execute SQL update in 'dbJpcEP' using connection'232188457' 
    2018-09-14 12:11:57,537 DEBUG DSRequest freeOnExecute is false for request of type update on DataSource LEG_SQUADRE - not freeing resources! 
    2018-09-14 12:11:57,538 DEBUG DataSourceDMI Invocation threw exception 
    java.sql.SQLException: Indice di colonna non valido
        at oracle.jdbc.driver.OraclePreparedStatement.setBinaryStreamInternal(OraclePreparedStatement.java:14350)
        at oracle.jdbc.driver.OraclePreparedStatement.setBinaryStreamInternal(OraclePreparedStatement.java:21927)
        at oracle.jdbc.driver.OraclePreparedStatement.setBinaryStream(OraclePreparedStatement.java:21111)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.setBinaryStream(OraclePreparedStatementWrapper.java:2046)
        at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
        at com.sun.proxy.$Proxy35.setBinaryStream(Unknown Source)
        at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:1253)
        at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:1189)
        at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:1357)
        at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:598)
        at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1848)
        at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:440)
        at com.isomorphic.sql.SQLDataSource.executeUpdate(SQLDataSource.java:389)
        at com.isomorphic.datasource.DataSource.execute(DataSource.java:2425)
        at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:646)
        at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:547)
        at com.isomorphic.application.AppBase.execute(AppBase.java:490)
        at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2835)
        at com.juve.legend.SquadreDMI.salvaLogoSquadra(SquadreDMI.java:91)
    'Indice di colonna non valido' means 'Invalid column index'

  • #2
    Hello, did you manage to reproduce the problem?
    Please let me know if you need other details.

    Comment


    • #3
      We havenít gotten to it yet, but it is assigned.

      Isolating it further would of course help speed resolution.

      Comment


      • #4
        Hello, after some more tests, the problem seems to be related to the fact that I'm invoking the update operation in a DMI where I call dsRequest.setValues(squadra), and 'squadra' is a Map (received from client), where I set the new values for the 'LOGO_IMG*' fields, ie:
        Code:
                        squadra.put("LOGO_IMG", inputStream);
                        squadra.put("LOGO_IMG_FILENAME", fileName);
                        squadra.put("LOGO_IMG_FILESIZE", size);
                        squadra.put("LOGO_IMG_DATE_CREATED", new Date());
        but, if those attributes were already present (valued), there are also the 'LOGO_IMG_FIELD*' attributes.
        So the dsRequest.setValues is called with a parameter like this:
        Code:
        0 = {java.util.HashMap$Entry@15979} "LOGO_IMG_FIELD_FILENAME" -> "MN.png"
        1 = {java.util.HashMap$Entry@15980} "ID_REC" -> "975393"
        2 = {java.util.HashMap$Entry@15981} "LOGO_URL_SUFFIX" -> ".png"
        3 = {java.util.HashMap$Entry@15982} "LOGO_IMG_FIELD" ->
        4 = {java.util.HashMap$Entry@15983} "LOGO_IMG_FIELD_DATE_CREATED" -> "2018-09-14 15:46:24.0"
        5 = {java.util.HashMap$Entry@15984} "LOGO_IMG_DATE_CREATED" -> "Tue Sep 25 15:02:04 CEST 2018"
        6 = {java.util.HashMap$Entry@15985} "LOGO_IMG_FIELD_FILESIZE" -> "8595"
        7 = {java.util.HashMap$Entry@15986} "LOGO_URL_PREFIX" -> "https://serverURL/loghi_squadre/"
        8 = {java.util.HashMap$Entry@15987} "LOGO_IMG" ->
        9 = {java.util.HashMap$Entry@15988} "SERVER_PATH" -> "smb://serverPath/loghi_squadre/"
        10 = {java.util.HashMap$Entry@15989} "FK_REGIONE" -> "22"
        11 = {java.util.HashMap$Entry@15990} "DESCRIZIONE" -> "AS Monaco FC"
        12 = {java.util.HashMap$Entry@15991} "CODICE_SQUADRA" -> "MN"
        13 = {java.util.HashMap$Entry@15992} "LOGO_IMG_FILESIZE" -> "8595"
        14 = {java.util.HashMap$Entry@15993} "LOGO_IMG_FILENAME" -> "MN.png"
        the SmartClient server seems to ignore the LOGO_IMG_FIELD* fields as per the log from post #1:
        Code:
        2018-09-14 12:11:57,532 INFO SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD since it has a customSelectExpression or customSQLExpression but no customUpdateExpression
        2018-09-14 12:11:57,532 INFO SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_DATE_CREATED since it has a customSelectExpression or customSQLExpression but no customUpdateExpression
        2018-09-14 12:11:57,532 INFO SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_FILENAME since it has a customSelectExpression or customSQLExpression but no customUpdateExpression
        2018-09-14 12:11:57,532 INFO SQLValuesClause [builtinApplication.null] Ignoring value for LOGO_IMG_FIELD_FILESIZE since it has a customSelectExpression or customSQLExpression but no customUpdateExpression
        but then the 'Invalid column index' error is raised.

        So, I've tried to remove those attributes:
        Code:
                        squadra.remove("LOGO_IMG_FIELD");
                        squadra.remove("LOGO_IMG_FIELD_FILENAME");
                        squadra.remove("LOGO_IMG_FIELD_FILESIZE");
                        squadra.remove("LOGO_IMG_FIELD_DATE_CREATED");
        and now it's working.

        anyway, I think it's a bug, correct? Or is it invalid usage?

        Comment


        • #5
          Yes it is a bug. It is fixed now and will be available for download in nightly builds since Sep 27 (tomorrow).

          Comment

          Working...
          X