我的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