0

Im connecting to an external database wich im not able to populate with testdata to do a proper integration test suite for my DAO on. As an alternative I would like to test the structure of the tables. For example that the tables im using has columns with certain names and types. How is this possible with Java/Spring?

In Oracle SQL Developer I can use desc <tableName>; to get what I want, is there someting smilar i can do from Spring?

2 Answers 2

1

You can use the DatabaseMetaData, see here for some inspiration (and test case here)

Sign up to request clarification or add additional context in comments.

Comments

0

You can also use dbms_metadata package(unless you're on XE release). This will either return DDL for a database object either as SQL script or as XML formatted string.

It's a way how SQLDeveloper reverse engineers object definitions. AFAIK you have to use database dependent approach for this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.