This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Alert Message in B&S Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Alert Message in B&S" Watch "Alert Message in B&S" New topic
Author

Alert Message in B&S

pramod karnani
Ranch Hand

Joined: May 22, 2007
Posts: 88

Hi All,

After starting server , when user will run network client and if he specified wrong ip address or port of server then I am displaying message in AlertBox "Failed to connect to database ".

Should I specified more detail with the above message like "Failed to connect to database since ip address/port are wrong" ?

when user type wrong ip address or port on console I get

SEVERE: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect




how can I know user specified wrong ip address or port . It just throw above exception in both case (wrong ip address and wrong port )

or to display message in AlertBox "Failed to connect to database ". is sufficient
otherwise we should give more detail to user why connection failed because of ip address or port or both?


please reply.


thanks
pramod
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 175
This looks like a design decision (albeit a small one) about the granularity of your error messages. Therefore it is your call whether you think you need to show this information or not.

Just make sure you document any design decisions in your choices.txt file for the assesor to see. In this case personally I would send a message
something like:

"Failed to connect to database. Please ensure you have entered the information correctly."


Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Mahesh Kumaraguru
Ranch Hand

Joined: Jun 01, 2005
Posts: 95
pramod karnani wrote:

how can I know user specified wrong ip address or port . It just throw above exception in both case (wrong ip address and wrong port )



A client application would not be able to know whether server is not running or ip address is wrong or port is wrong.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alert Message in B&S
 
Similar Threads
java.rmi.ConnectException: Connection refused to host
Call a Servlet from JSP
Java RMI Connection Problem
javaMail and loosing my marbles!
java.rmi.ConnectException