2016-02-04 47 views
0

我想用我的數據庫使用JSP工作,我是全新的JSP,但我熟悉JAVA語言。我得到的follwoing錯誤的follwowing代碼:使用java.sql.Connection時得到錯誤

Multiple annotations found at this line: 
- java.sql.Connection cannot be resolved to a 
variable 

這是代碼:

<%@ page import="java.sql.*"%> 
<%@ page import="javax.sql.*"%> 
<%@ page language="java" contentType="text/html; charset=UTF-8" 
    pageEncoding="UTF-8"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>Login check</title> 
</head> 
<body> 
<% 
    String username = request.getParameter("username"); 
    String password = request.getParameter("password"); 
    Class.forName("com.mysql.jdbc.Driver"); 
    java.sql.Connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/jspexample", "root", ""); 
%> 

</body> 
</html> 

,正如你可以在圖片中看到我添加的JDBC連接器的罐子: enter image description here

回答

0

我發現IDE中存在一個錯誤,所以我嘗試編譯它,並且一切都很好。