S
Sameer
The init method for a servlet is as follows:
public void init(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection =
DriverManager.getConnection("jdbcdbc:library");
} catch(ClassNotFoundException cnfe) {
System.err.println("Error loading driver: " + cnfe);
} catch (SQLException ex) {
ex.printStackTrace();
}
}
The Stack Trace does not print in the browser and we also do not have
access to HttpServletResponse object.
Then how it is possible to display an error message in the client's
browser if database connection fails?
public void init(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection =
DriverManager.getConnection("jdbcdbc:library");
} catch(ClassNotFoundException cnfe) {
System.err.println("Error loading driver: " + cnfe);
} catch (SQLException ex) {
ex.printStackTrace();
}
}
The Stack Trace does not print in the browser and we also do not have
access to HttpServletResponse object.
Then how it is possible to display an error message in the client's
browser if database connection fails?