我的servlet功能SQLSERVER的连接类NOTFOUND例外看起来像这些:在日食
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");
}
}
输出变为两个卡扣statements.How克服呢?
尽快回复?
我在WEB-INF/lib文件夹中复制,但它不是在eclipse.how显示克服呢? – karthik 2011-06-16 13:48:44
@karthik你有没有尝试刷新Eclipse项目? (右键单击 - >刷新)。然后,您可以将该JAR文件添加到Eclipse。 – 2011-06-16 13:58:58
刷新后,它工作正常。感谢很多。 – karthik 2011-06-16 14:01:04