數(shù)據(jù)添加不上
我在添加時總是出現(xiàn)
thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'mobile' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2983)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:882)
at com.imooc.dao.GoddessDao.addGoddess(GoddessDao.java:34)
at com.imooc.action.GoddessAction.main(GoddessAction.java:22)
的錯誤不知道為什么,sq語句也沒有錯,我在數(shù)據(jù)庫里面能添加上去,代碼和老師講的一樣。
網(wǎng)上寫的是字段過長我不明白怎么處理?
2016-07-06
把你的代碼貼出來
2016-03-10
Connection conn=null;
//加載驅(qū)動
try {
Class.forName("com.mysql.jdbc.Driver");
//建立連接
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/office?dbuseUnicode=true&characterEncoding=UTF-8", "root", "root");