Overcomplicated oracle jdbc BLOB handling

前端 未结 9 1014
予麋鹿
予麋鹿 2020-12-04 18:20

When I search the web for inserting BLOBs into Oracle database with jdbc thin driver, most of the webpages suggest a 3-step approach:

  1. insert empty_blob()
9条回答
  •  清歌不尽
    2020-12-04 18:24

    Provided the CLOB data is small enough to fit in your memory without blowing up, you can just create a prepared statement and simply call

    ps.setString(1, yourString);
    

    There may be other size limitations, but it seems to work for the sizes we're dealing with (500kB max).

提交回复
热议问题