Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Dear Everyone,

I want to know about my JAVA problem.
I stoped oracle server like this.
MyComputer=>Manage=>Server=>Oracle Ex=> I stoped it.
Then I run My Login Page.
When I click Login Button.
Immediately I found error.
I cannot run my login page.
How to handle exception in showing user?
Posted
Comments
DamithSL 2-Jun-14 22:02pm    
what is the exception?
Richard MacCutchan 3-Jun-14 3:37am    
What is the exception, what does this have to do with Java? If you want help then please provide proper details.
TorstenH. 3-Jun-14 4:17am    
the login page is running into time out?

What Framework are you using? Any chance to create custom Error 500 pages?
TusharZoo 3-Jun-14 13:48pm    
what is the exception? what you want to do?

As Far as I understood, You are trying to show a message that the Database is unavailable,
To do that, You can use Excepion Handling Techniques offered by the Java Language,

The General Format of handling an exception is

Java
try
{
  // erraneous code
}
catch(Exception e)
{
  // Exception Handling code
}



The catch statement can be different exception types and can be given different exception handling codes for different exceptions.

a quick but incomplete solution could be,

Java
try
{
  // Your DB connection code
}
catch(Exception e)
{
  System.out.println("ERROR : Could not connect to database.");
}


If you also need the stack trace for debugging purposes you can also use e.printStackTrace();
 
Share this answer
 
v2
You means you want to show the message to user like DSB server is down. if so you can use exception handling while establishing the connection and if it fails you can show user friendly error message.

Regards,
Abhi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900