Thursday, February 20, 2020

Tweaking pure RDBMS like Informix to store JSON

After having a quick overview in NoSQL DB, a natural thought was 
How can 
sql="insert into table(col1,col2,jsoncol) values(?,?,(?::JSON))";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, '');
pstmt.setString(2, '');
pstmt.setString(3, jsondata.toJSONString().replaceAll("\\\\/","/"));
pstmt.executeUpdate();
?::JSON like this
select data::JSON from table_name
 
Please note this is
works for Informix DB alone.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Followers