How can I find out all the tables currently defined in an oracle database? How can I do this with JSP? I just want to have a JSP page that prints out all the tables names. Also how can I print out all the attributes of a specific table? also in JSP? thanks
Bob, Kyle Brown (who incidentally is a bartender here) wrote a good article that walks you through using metadata. He shows how to get a list of tables (which you now know) and how to get column info from those tables..
Also, note that it is good practice to do JDBC outside the JSP. You can put it in a Java class. Then call that class from a servlet and forward to a JSP. This creates a cleaner, more maintainable JSP.
Using DatabaseMetaData is the standard JDBC, databse-independent way of doing it.
In Oracle, there are a large number of "data dictionary" views potentially available to you (although access to them and the results they return to you will vary depending on database version and your user privileges and the security setup in your database).
You can see what's potentially available with:
Personally, I find USER_OBJECTS, USER_TABLES, USER_TAB_COLUMNS, and USER_VIEWS to be the most useful (or the ALL version), day-to-day.