I need to know a way to check from a Java Desktop App, if a Oracle’s view exist in the current DB before execute a query otherwise I will get a lot of troubles…
thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can always query the Oracle data dictionary. Something like
will tell you whether you have access to a view owned by the specified user with the specified name.
Alternately, you can use a more Java-centric approach. You can create a
DatabaseMetaDataobject from yourConnectionand callgetTablesto get a list of all the tables and views that you have access to. You can passgetTablesa specific table or view name (or a pattern) to restrict the results.