Announcement Announcement Module
No announcement yet.
DB Connection Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DB Connection

    Hi All,
    i wanted to check whether my application got connected to DB, if not i want show an error message.
    Which is the best place to check this and disply appropriate message.

    Thanks in advance.

  • #2
    Any chance you can explain more about what you are trying to do?
    Last edited by karldmoore; Aug 29th, 2007, 10:53 AM.


    • #3

      In my application i am rendering homepage by reading entries from a databse.
      If that database is down or couldnt retrive a connection to query. Then i wanted to disply an error message saying that "connection failed!".
      Not only for this home page but through out the application if connection lost or DB goes down proper error message should be displayed.

      Currently i am catching a SQLException in Controller and in that cath block i am rejecting a value using errors.rejectValue(....). With this approach each time if i dip into DB I must catch an SQLException? Or any better approach.

      Thank you
      Last edited by Sharath; Jul 5th, 2007, 07:04 AM.


      • #4
        IMHO, catching SQLException and populating various error messages shoudl be fine..
        you are already doing what you would like to do.. you can't connect to DB, code raises a SQLException and you act accordingly..

        unless you want some other fancy features.. in that case could you elaborate better what you would like to achieve?