• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DatabaseMetaData

 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I want to develop an application to retrieve all information about Database Management System.
I use DatabaseMetaData to get those information.
I see all the method on that interface always throw SQLException.
How can I distinguish about SQLException whether it is connection error or that database management system is not supported a feature?

thanks
daniel
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daniel,
The exception getMessage() will provide more information. The actual message is database dependent. But you can try it once by hand and see what message your database gives for connection errors. (try turning off the database or pointing at a non-existant database to do this)
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
I tried my application with Oracle Database.
And some feature is not supported by Oracle, the JDBC driver will throw SQLException with message "Unsupported feature".

Oh.. I am sorry to not describe my application clearly.
My application will display all database's features.
If there is a feature that a database doesn't support so I want my application will display "Not Available".
Because of that I want to know how I can distinguish the error message within SQLException.

Hope this help you to understand my case..
Thank you very much for your attention

daniel
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daniel,
Try something like this:

Then you can have CustomerUnsupportedException redirect to an error page or otherwise display a clear message.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic