I currently am spinning up an HSQL DB in-memory to play with some data and not actually need to query against my DEV DB.
So I have the following setup
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL)
.setName("myFakeDB")
.addScript("my-tables.sql")
.addScript("my-data.sql")
.build();
return db;
}
In the my-data.sql I insert data into my table in buckets of 10, so something like
INSERT INTO table (column_a, column_b, column_c) VALUES
(...),
(...),
// Do this 10 times total
;
Now I've noticed if I have somewhere between 1-1000 records its fine. But once I surpass that number it dies with the following error:
org.hsqldb.HsqlException: unknown token:
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ParserBase.read(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatements(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 92 common frames omitted
Wrapped by: java.sql.SQLSyntaxErrorException: unknown token:
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:473)
... 89 common frames omitted
Is there a max number of records I can add in a single .sql file? I have roughly 10,000 records and I would prefer to not have to cap my insert count < 1000 and have 10-11 different .sql files
There is no maximum record count in HSQLDB.
The error indicates there is a word or symbol in your script file that is not recognised. Check your script to isolate and fix the issue.