Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-14182

Infinispan jdbc-sql-store cannot recognize type CHAR

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 13.0.11.Final
    • Persistence
    • None
    • Hide

      1 - You need have a Database of your own choice. I Used an Oracle Database. But should be anyone.

       

      2 - The database must have a column typed as char. The create table that I used is:

       

      CREATE TABLE ORAMMD.CLI_TESTE (
      CD_CLI NUMBER (10,0) NOT NULL ENABLE,
      COD_TIPO NUMBER(4,0) NOT NULL ENABLE, 
      NOM VARCHAR2(60) NOT NULL ENABLE, 
      IND_FICH_PROV CHAR(1) NOT NULL ENABLE, 
      PRIMARY KEY (CD_CLI)
      )

       

       

      3 - At the Infinispan server console create a new cache with the following config:

      {
          "distributed-cache": {
              "encoding": {
                  "media-type": "application/x-protostream"
              },
              "persistence": {
                  "table-jdbc-store": {
                      "dialect": "ORACLE",
                      "shared": "true",
                      "table-name": "SCHEMA.YOUR_TABLE",
                      "schema": {
                          "message-name": "DATAGRID",
                          "key-message-name": "DgKey",
                          "package": "example.com",
                          "embedded-key": "false"
                      },
                      "connection-pool": {
                          "connection-url": "jdbc:oracle:thin:@//YOURHOST:1521/YOURDB",
                          "driver": "oracle.jdbc.OracleDriver",
                          "username": "ChangeMe",
                          "password": "ChangeMe"
                      }
                  }
              }
          }

      4 - To Reproduce you don't need have to declare no protobufer schema. The error happens before the protobuff conversion.

       

       

      Show
      1 - You need have a Database of your own choice. I Used an Oracle Database. But should be anyone.   2 - The database must have a column typed as char. The create table that I used is:   CREATE TABLE ORAMMD.CLI_TESTE ( CD_CLI NUMBER (10,0) NOT NULL ENABLE, COD_TIPO NUMBER(4,0) NOT NULL ENABLE,  NOM VARCHAR2(60) NOT NULL ENABLE,  IND_FICH_PROV CHAR(1) NOT NULL ENABLE,  PRIMARY KEY (CD_CLI) )     3 - At the Infinispan server console create a new cache with the following config: {     "distributed-cache" : {         "encoding" : {             "media-type" : "application/x-protostream"         },         "persistence" : {             "table-jdbc-store" : {                 "dialect" : "ORACLE" ,                 "shared" : " true " ,                 "table-name" : "SCHEMA.YOUR_TABLE" ,                 "schema" : {                     "message-name" : "DATAGRID" ,                     "key-message-name" : "DgKey" ,                     " package " : "example.com" ,                     "embedded-key" : " false "                 },                 "connection-pool" : {                     "connection-url" : "jdbc:oracle:thin:@ //YOURHOST:1521/YOURDB" ,                     "driver" : "oracle.jdbc.OracleDriver" ,                     "username" : "ChangeMe" ,                     "password" : "ChangeMe"                 }             }         }     } 4 - To Reproduce you don't need have to declare no protobufer schema. The error happens before the protobuff conversion.    
    • Documentation (Ref Guide, User Guide, etc.)

    Description

      I've been followed the Infinispan documentation

      https://infinispan.org/docs/stable/titles/configuring/configuring.html#sql-store-data-types_persistence

      When I tried to create a persistence cache with table-jdbc-store with Oracle database I´ve got an exception: "SqlType not supported: 1". The table have a column typed as char.

       

      I' have looked the code, and class:

      package org.infinispan.persistence.sql;
      
      public abstract class AbstractSchemaJdbcStore

       
      Maybe I found a bug in the method:

       

            protected static ProtostreamFieldType from(int sqlType) {
               switch (sqlType) {
                  case Types.INTEGER:
                     return INT_32;
                  case Types.BIGINT:
                     return INT_64;
                  case Types.FLOAT:
                  case Types.REAL:
                     return FLOAT;
                  case Types.DOUBLE:
                  case Types.NUMERIC:
                  case Types.DECIMAL:
                     return DOUBLE;
                  case Types.BIT:
                  case Types.BOOLEAN:
                     return BOOL;
                  case Types.VARCHAR:
                  case Types.NVARCHAR:
                  case Types.LONGVARCHAR:
                  case Types.LONGNVARCHAR:
                     return STRING;
                  case Types.BLOB:
                  case Types.BINARY:
                  case Types.VARBINARY:
                  case Types.LONGVARBINARY:
                     return BYTES;
                  case Types.DATE:
                  case Types.TIMESTAMP:
                  case Types.TIMESTAMP_WITH_TIMEZONE:
                     return DATE;
                  default:
                     throw new IllegalArgumentException("SqlType not supported: " + sqlType);
               }
            }

       
      when it tries a type.char so it throws a new exception. And the SQL Type not supported It's a char type.

       
       

      Attachments

        1. Erro.JPG
          Erro.JPG
          94 kB
        2. ErrosLog.txt
          19 kB

        Activity

          People

            wburns@redhat.com Will Burns
            diogo.romm Diogo Raul Martins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: