spock-dbunit
spock-dbunit copied to clipboard
org.dbunit.dataset.NoSuchTableException: abc
I have below code in my spec file: @DbUnit(configure={ IDatabaseTester it -> it.setUpOperation = InsertIdentityOperation.REFRESH it.tearDownOperation = InsertIdentityOperation.DELETE }) def content = { abc(id:123, name:'test') }
This working finr in MySql, but when I try to run for MSSQL it gives org.dbunit.dataset.NoSuchTableException : abc error.
I have verified the 'abc' table is already there in MSSSQL database.
While debugging I have found that connection.getSchema() return "".
So how I can pass schema 'dbo' to @DbUnit extension?
I don't want to pass in every class @DBUnit(schema='dbo', configure......) like this.
Instead is it possible to get schema from field like we get datasource.
Hi @Kanti1702 , that's not possible yet and I also don't want to keep the plugin as simple enough and not depend on too many ways to get it working. So currently your only option is to ...
- add the schema in the @dbunit annotation
- deal with it on the datasource level. F.e. in most connection pools, you can specify a sql that is executed when the connection is first initialized f.e. in https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/DataSourceProxy.html#setInitSQL(java.lang.String) Hope this helps