jonvines jonvines - 1 year ago 130
C# Question

Kafka Connect to MSSQL Server Decimal conversion

We're using the Confluent JDBC connector to extract data from a MS SQL database. We're experiencing problems with the extraction of a decimal column with a column data format of

which is passing data as bytes rather than decimal.
(this is taken from the console from a consumer and shows the schema registry structure).

Has anybody seen this behavior with the Connectors before and know how we'd go about resolving?


Answer Source

There is currently limited support for use of Schema Registry with .Net. Therefore, we had to manually manipulate the byte array to produce the decimal.

This involved padding and reversing the byte array, making an assumption on precision and scale, and determining whether positive or negative based on the first value ( > 128 == negative). We also had to append a .01 for every negative decimal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download