I m a freshman about JSP.Now I have a quesstion about sql.
first I made a class.Code is
public class DataBase {
protected String url = "jdbc:mysql://localhost:3306/lab?user=root&password=root&"
+ "useUnicode=true&characterEncoding=utf-8";
public Connection conn = null;
public DataBase() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (java.lang.ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
conn = DriverManager.getConnection(url);
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
then anothe class code is
public void addUser(String userName, String userPasswd, int userPower) {
userCheck=1;
sql="insert into user(userPasswd,userPower,userName,userCheck)values(?,?,?,?)";
pstm=dataBase.conn.prepareStatement(""); <-here is a err it is
Type mismatch: cannot convert from PreparedStatement to PreparedStatement.
I do not know why?
}
thank first!