如何在java中将Jsonnode转换为Blob?

如何在java中将Jsonnode转换为Blob?,java,blob,Java,Blob,我有一个Jsonnode对象,如果将其转换为字符串,它将如下所示: {"id": "A1", "address":"xxxx", "loginhistory":[{"ip":"xxx", "time":"xxx},{"ip":"xxx", "time":"xxx}] } 我尝试将其转换为blob,我目前编写的代码如下: Jsonnode node = ....; String s = mapper.writeValueAsString(node); String sql = "UPDATE u

我有一个Jsonnode对象,如果将其转换为字符串,它将如下所示:

{"id": "A1", "address":"xxxx", "loginhistory":[{"ip":"xxx", "time":"xxx},{"ip":"xxx", "time":"xxx}] }
我尝试将其转换为blob,我目前编写的代码如下:

Jsonnode node = ....;
String s = mapper.writeValueAsString(node);
String sql = "UPDATE users "
            + "SET info = ? "
            + "WHERE UserName = ?";
PreparedStatement statement = connection.prepareStatement(sql)) {
                Blob blob = connection.createBlob();
                blob.setBytes(1, s.getBytes(Charset.forName("UTF-8")));
                statement.setQueryTimeout(timeout);
                statement.setBlob(1, blob);
                statement.setString(2, username);
                statement.executeUpdate();
}
我希望
info
是blob,但它看起来像是我将其更新为string(如我给出的string示例所示)。有人能教我如何将Jsonnode转换为Blob吗