Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQLException: String or binary data would be truncated

13 views
Skip to first unread message

jrefa...@hotmail.com

unread,
Jul 15, 2005, 12:58:45 AM7/15/05
to
The Java program inserted data to table, but it throws exception
"String or binary data would be truncated."

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Str
ing or binary data would be truncated.
at
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(
Unknown Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Sour
ce)
at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType
(Unknown Source)
at
com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown
Source)
at
com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown
Source)
at
com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown S
ource)
at com.microsoft.jdbc.base.BaseStatement.executeUpdate(Unknown
Source)
at SQLHelper.insertRecord(SQLHelper.java:24)

Any ideas? thanks!!

quai...@gmail.com

unread,
Jul 15, 2005, 3:20:51 AM7/15/05
to
Hi,

This exception is thrown when one of database table column cannot keep
the amount of data being inserted into it. For example your database
table has a colum named "TestColumn" of type "VARCHAR(10)". Now if you
will try to insert a string of length greater than 10, the program will
throw same exception...

Regards,

Yasir Khan

0 new messages