Ignititedb defines a date type in a field.
JdbcResultSet uses the getBytes function (org.apache.ignite.internal.jdbc2)
Because the field will be java.sql.Date type, there will be an exception to
the last else.
How to deal with it?

 @Override public byte[] getBytes(int colIdx) throws SQLException {
        Object val = getValue(colIdx);

        if (val == null)
            return null;

        Class<?> cls = val.getClass();

        if (cls == byte[].class)
            return (byte[])val;
        else if (cls == Byte.class)
            return new byte[] {(byte)val};
        else if (cls == Short.class) {
            short x = (short)val;

            return new byte[] {(byte)(x >> 8), (byte)x};
        }
        else if (cls == Integer.class) {
            int x = (int)val;

            return new byte[] { (byte) (x >> 24), (byte) (x >> 16), (byte)
(x >> 8), (byte) x};
        }
        else if (cls == Long.class) {
            long x = (long)val;

            return new byte[] {(byte) (x >> 56), (byte) (x >> 48), (byte) (x
>> 40), (byte) (x >> 32),
                (byte) (x >> 24), (byte) (x >> 16), (byte) (x >> 8), (byte)
x};
        }
        else if (cls == String.class)
            return ((String)val).getBytes();
        else
            throw new SQLException("Cannot convert to byte[]: " + val,
SqlStateCode.CONVERSION_FAILED);
    }


Can refer to line 462
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to