My servlet function looks like these:
CODE:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
String userName;
String passwd;
Connection conn = null;
userName = (String)request.getParameter("userName");
passwd = (String)request.getParameter("password");
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //Or any other driver
}
catch( Exception x ){
System.out.println( "Couldn’t load drivers!" );
}
try
{
conn = DriverManager.getConnection("jdbc:sqlserver://192.168.0.123:1433;databaseName=test","sample","sample");
}
catch( Exception x)
{
System.out.println("Couldnot get connection");
}
}
the output goes to two catch statements.How to overcome this?
Reply as soon as possible?