JDBC, MySQL: getting bits into a BIT(M!=1) column

前端 未结 2 1913
广开言路
广开言路 2020-12-21 22:46

I\'m new to using JDBC + MySQL.

I have several 1/0 values which I want to stick into a database with a PreparedStatement. The destination column is a BIT(M!=1). I\

2条回答
  •  天涯浪人
    2020-12-21 23:26

    You can use get/setObject with a byte array (byte[]). 8 bits are packed into each byte with the least significant bit being in the last array element.

提交回复
热议问题