# JDBC plugin - issue getting binary data

**URL:** <https://discuss.elastic.co/t/jdbc-plugin-issue-getting-binary-data/332537>\
**Category:** Logstash\
**Created:** [May 4, 2023, 10:25am UTC](https://discuss.elastic.co/t/jdbc-plugin-issue-getting-binary-data/332537 "2023-05-04T10:25:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vymk](https://avatars.discourse-cdn.com/v4/letter/v/7bcc69/32.png) [@vymk](https://discuss.elastic.co/u/vymk)\
**Post date:** [May 4, 2023, 10:25am UTC](https://discuss.elastic.co/t/jdbc-plugin-issue-getting-binary-data/332537/1 "2023-05-04T10:25:50Z")

</div>

I use the JDBC plugin to get data from a MSSQL database. Generally this is working but my query output includes MD5 hashes saved as binary, and then the output looks something like this in stdout (and even more gibberish in a file output, further resulting in an error sending the data to Elasticsearch)

`"md5" => #<Sequel::SQL::Blob:0x120c bytes=16 content="\x04\xB7\xA42j3\x9Dv&\x1Fh\xE3L8\xC5\xEA">`

I tried setting various columns\_charset, but without success. What do I have to do to here?

---

<div class="post-metadata">

**Author:** ![vymk](https://avatars.discourse-cdn.com/v4/letter/v/7bcc69/32.png) [@vymk](https://discuss.elastic.co/u/vymk)\
**Post date:** [May 10, 2023, 9:25am UTC](https://discuss.elastic.co/t/jdbc-plugin-issue-getting-binary-data/332537/2 "2023-05-10T09:25:26Z")

</div>

Finally ChatGPT helped me to solve this with this function:

```auto
  ruby {
    code => '
      require "sequel"
      event.set("unpacked", event.get("md5").unpack("H*").first.force_encoding("UTF-8"))
    '
  }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 7, 2023, 9:25am UTC](https://discuss.elastic.co/t/jdbc-plugin-issue-getting-binary-data/332537/3 "2023-06-07T09:25:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
