Is there a way to obtain the list of all table names in the database using Spring's SimpleJdbcTemplate?
The database being queried is Oracle if that helps in any way. Thanks.
Is there a way to obtain the list of all table names in the database using Spring's SimpleJdbcTemplate?
The database being queried is Oracle if that helps in any way. Thanks.
You're always free to get java.sql.DatabaseMetaData using the Connection. There aren't any methods in SimpleJdbcTemplate to help you, but frankly there's no need. Just follow this recipe.
Query the USER_TABLES view and you will get them.
poke around in sqlplus, of course, to see the shape first.
Spring has a DatabaseMetaDataCallback
object that can take care of some of the boiler plate aspects of the solution that duffymo has linked to. You can then pass that object when calling JDBCUtils.extractDatabaseMetaData
.
An example of making the same call you're trying to make with those classes can be found here.