Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data base update query exception handling error

String Query="insert into sms (Jobno, Mobilenumber, MStatus, ReceivedTime, AmountDeducted, Message, DoneTime)       values ("+jobnum +","+mobilenum+","+ smsstatus+",'"+ rxtimestamp+ "',"+ amt+",'"+smstxt+"','"+timedone1+"')";

Note: Through the Mysql the above query is executed successfully....

I imported all the required libraries and their respective interfaces in the program.... When i execute through java panel/ide its throwing the following errors?

Exception in thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'Mobilenumber' 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:3277)
    at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1402)
    at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1317)       

Please suggest what could be the problem...........

like image 559
Karthik Kolla Avatar asked Dec 29 '25 22:12

Karthik Kolla


1 Answers

The amount of value from the variable mobileNumber is more than its limit. So check the datatype you have defined in both DB and java program and verify the mobileNumber you have given to save.

like image 137
MGPJ Avatar answered Jan 01 '26 12:01

MGPJ