String key = "key";
String value = "Hello World";
PreparedStatement prep = conn.prepareStatement("CALL ENCRYPT('AES', RAWTOHEX(?), STRINGTOUTF8(?))");
prep.setCharacterStream(1, new StringReader(key), -1);
prep.setCharacterStream(2, new StringReader(value), -1);
ResultSet rs = prep.executeQuery();
rs.next();
String encrypted = rs.getString(1);
PreparedStatement prep2 = conn
.prepareStatement("CALL TRIM(CHAR(0) FROM UTF8TOSTRING(DECRYPT('AES', RAWTOHEX(?), ?)))");
prep2.setCharacterStream(1, new StringReader(key), -1);