set idenity_insert giving error

95 views
Skip to first unread message

Divya S

unread,
Nov 19, 2020, 2:56:00 PM11/19/20
to H2 Database

We are using H2Database for unit testing.
We have SET IDENTITY_INSERT <SchemaName.table_name> ON/OFF; in our DML .sql file. This works perfectly fine in our production sql server. But this lines fails in h2database.
H2 properties::

{ "driverClass": "org.h2.Driver", "user": "test", "password": "test", "url": "jdbc:h2:mem:testdb;IGNORECASE=TRUE;DB_CLOSE_DELAY=-1;TRACE_LEVEL_FILE=3;TRACE_LEVEL_SYSTEM_OUT=3", "properties": { "charSet": "UTF-8", "mode": "MSSQLServer" } }

Error :

org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "SET IDENTITY_INSERT[*] mytable ON "; expected "@, AUTOCOMMIT, MVCC, EXCLUSIVE, IG NORECASE, PASSWORD, SALT, MODE, COMPRESS_LOB, DATABASE, COLLATION, BINARY_COLLATION, UUID_COLLATION, CLUSTER, DATABASE_EVENT_LISTENER, ALLOW_LITERALS, DEFA ULT_TABLE_TYPE, CREATE, HSQLDB.DEFAULT_TABLE_TYPE, PAGE_STORE, CACHE_TYPE, FILE_LOCK, DB_CLOSE_ON_EXIT, AUTO_SERVER, AUTO_SERVER_PORT, AUTO_RECONNECT, ASSE RT, ACCESS_MODE_DATA, OPEN_NEW, JMX, PAGE_SIZE, RECOVER, NAMES, SCOPE_GENERATED_KEYS, SCHEMA, DATESTYLE, SEARCH_PATH, SCHEMA_SEARCH_PATH, JAVA_OBJECT_SERIA LIZER, LOGSIZE, FOREIGN_KEY_CHECKS"; SQL statement: SET IDENTITY_INSERT mytable ON [42001-199]
Reply all
Reply to author
Forward
0 new messages