question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DBUnit escape pattern on multiple database tests

See original GitHub issue

I have my tests on multiple databases (H2, PostgreSQL, MariaDB), and I want to use an escape pattern specific to the database test currently running. Here is my test configuration:

@DBRider
@DBUnit(caseSensitiveTableNames = true, escapePattern = "\"")
@SpringJUnitConfig(RepositoryTestBase.Config.class)
public abstract class RepositoryTestBase {

    @Configuration
    public static class Config {

    }
}

The test classes will extend the abstract class above and be annotated with @DataSet for the sample data. On the class above, I use escape pattern " which works for H2 and PostgreSQL, while on MariaDB I get SQL syntax error below for table name path:

org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"path"' at line 1

What is the best way to make it possible to set escape pattern on multiple database tests? Thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rmpestanocommented, Aug 10, 2021

The fix for this issue is available on v1.28.0 which was just released, thank you for the contribution @muhammadkholidb!

1reaction
muhammadkholidbcommented, Aug 5, 2021

Nice, I’ll create a PR for that. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

[dbunit-user] Specifying escape pattern for DatabaseTestCase
We've got some columns in our MSSQL database that have spaces in the names (like "Client ID"). When using the dbunit ant task,...
Read more >
Configurable Features and Properties - DBUnit
Allows schema, table and column names escaping. The property value is an escape pattern where the ? is replaced by the name. For...
Read more >
Escaping reserved database keywords with spring-test-dbunit
From Expoting Dataset to a xml file giving error in DBunit, I see that this can be done in dbunit by setting a...
Read more >
DbUnit - Configurable Features and Properties
Escape pattern ; Default, none ; Description, Allows schema, table and column names escaping. The property value is an escape pattern where the...
Read more >
1.9.1 - Database Rider Documentation
2. Seeding database. In order to insert data into database before test execution. As a developer. I want to easily use DBUnit in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found