简体   繁体   中英

Insert java byte array in table using Statement

我们可以使用Statement类(不使用Prepared语句)将Java字节数组作为blob数据类型插入hsqldb表中吗?

Since you shouldn't insert user data into a SQL statement using string concatenation anyway, why do you care?

Using PreparedStatement is the right way to do it.


Though, technically, you could execute a SELECT statement, and insert the data using an updatable ResultSet , but I wouldn't recommend it. Inserting a row using a dummy SELECT statement is just plain unnecessary overhead.

Or you could build a HSQLDB Binary Literal , but why go through all that work, when you'll get it for free with a PreparedStatement ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM