P
PC Leung
The following coding always run into SQLException.
what's wrong with my coding?
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erptest?user=xxx&password=yyy");
PreparedStatement stmt = conn.prepareStatement("INSERT INTO users
(usernm, passwd) VALUES (?, ?)");
stmt.setString(1, sUsername);
stmt.setString(2, sPassword);
iCount = stmt.executeUpdate();
if (iCount==1) bReturn = true;
logger.info("count:" + iCount);
stmt.close();
conn.close();
} catch (SQLException E) {
what's wrong with my coding?
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erptest?user=xxx&password=yyy");
PreparedStatement stmt = conn.prepareStatement("INSERT INTO users
(usernm, passwd) VALUES (?, ?)");
stmt.setString(1, sUsername);
stmt.setString(2, sPassword);
iCount = stmt.executeUpdate();
if (iCount==1) bReturn = true;
logger.info("count:" + iCount);
stmt.close();
conn.close();
} catch (SQLException E) {