javanna
javanna

Reputation: 60235

How to test SQL dynamic queries?

My applications are Spring/iBatis (2.3) based. I usually write a lot of dynamic queries in my sqlMaps and I'd like to test my generated SQL queries to avoid any syntax errors. For more precision, I want to:

  1. check the SQL syntax (depending on the sql dialect) of all my generated queries
  2. check if my queries work correctly with the actual database structure

Does already exist a library that gives me the chance to check the SQL syntax (step 1), depending on the sql dialect (I'm actually using Oracle), without a database connection?

Does already exist a sqlMap parser which could help me generating all potential queries, containing all combinations of dynamic parameters?

Basically, I'm thinking about a way to avoid writing one (or more) unit test per query. I'd like to automate this step to be sure that my generated queries are always right. Any other suggestions?

Upvotes: 1

Views: 2670

Answers (1)

sme
sme

Reputation: 5671

There is a related question and some people suggested using DBUnit. Maybe you should give it a try.

Upvotes: 1

Related Questions