|
Okay, the above problem is solved
But why
I insert the database is always empty
I used him to insert data
try {
System.out.println("ejbCreate() method is called");
con = getConnection();
String sqlStr = "insert into UserIfometion(UserName,Userpwd,"
+ "RealName,sex,UserItrduce)"
+ "values (?,?,?,?,?)";
pstmt = con.prepareStatement(sqlStr);
pstmt.setString(1, username);
pstmt.setString(2, userpwd);
pstmt.setString(3, realname);
pstmt.setString(4, sex);
pstmt.setString(5, useritrduce);
System.out.println(sqlStr);
System.out.println("888888888888888888888888888888888888888");
pstmt.executeUpdate();
pstmt.execute();
System.out.println(username);
System.out.println(userpwd);
System.out.println(realname);
System.out.println(sex);
System.out.println(useritrduce);
System.out.println("dhhhhhhhhhhhhhhhhhddddddddddd oh");
return null;
} catch (Exception e) {
throw new CreateException(e.toString());
} finally {
try {
if (pstmt != null) {
pstmt.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Below is the test side
try{
home.create("Yang Yongqi","66113576","Gardenia","Male","TNND");
}catch(Exception e){}
I can display the value of the test terminal but I cannot insert it
But I have an auto-incremented field whose value is changing
TNND |
|