この値を変更するには、SET LOCK_TIMEOUTを使う。
接続時に値を変更する場合は、下のようにURLの後にLOCK_TIMEOUTを指定する。
jdbc:h2:test;LOCK_TIMEOUT=10000
jdbc:h2:test;LOCK_TIMEOUT=10000
insert into hoge (binary) values (X'3031323334353637383930');
Return a result set that contains the last generated auto-increment key for this connection, if there was one. If no key was generated by the last modification statement, then an empty result set is returned. The returned result set only contains the data for the very last row.
compile 'com.h2database:h2:1.3.176'
jdbcDataSource.connection.use {connection -> connection.createStatement().use {statement -> statement.execute("create table test(id bigint auto_increment, name varchar(255))") } connection.prepareStatement("insert into test (name) values (?)").use { ps -> for (i in 1..10) { ps.setString(1, "name_$i") ps.addBatch(); } ps.executeBatch() ps.generatedKeys.use { while (it.next()) { println("it.getInt(1) = ${it.getInt(1)}") } } } }
CREATE TABLE IF NOT EXISTS USER ( ID BIGINT NOT NULL AUTO_INCREMENT, NAME VARCHAR(100 CHAR) NOT NULL, PRIMARY KEY (ID) );