我试图建立连接但出现上述错误。
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/cams?zeroDateTimeBehavior=convertToNull", "root", "root");
System.out.println("Connected to Database successfully");
Statement st = conn.createStatement();
s.assignStall(s.numOfStall + 1, stallOwnerId, category, iCanSelected,
contact, name, add, email, unitNo, stallName);
s.showAssignedStall();
/*
int result = st.executeUpdate(
"INSERT INTO StallOwner" (sId, sCat, cant, sContact,
sName, sAdd, sEmail, sUnitNo, sStallName) VALUES(
"")
)
*/
jTextFieldUserId.setText("");
jTextFieldName.setText("");
jTextFieldAddress.setText("");
jTextFieldContact.setText("");
jTextFieldEmail.setText("");
jTextFieldUnitNo.setText("");
jTextFieldStallName.setText("");
} catch (Exception e) {
System.out.println("Error: " + e.toString() + e.getMessage());
}
}
这是我第一次使用 JDBC。请帮忙