SQLException: String or binary data would be truncated

Discussion in 'Java' started by jrefactors@hotmail.com, Jul 15, 2005.

  1. Guest

    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!!
     
    , Jul 15, 2005
    #1
    1. Advertising

  2. Guest

    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

    wrote:
    > 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!!
     
    , Jul 15, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2ZQ==?=
    Replies:
    2
    Views:
    15,999
    Alexey Smirnov
    Jul 15, 2007
  2. egsdar
    Replies:
    0
    Views:
    1,565
    egsdar
    Dec 13, 2008
  3. George Jackson
    Replies:
    1
    Views:
    213
    George Jackson
    Jan 11, 2006
  4. J. Muenchbourg

    String or binary data would be truncated error

    J. Muenchbourg, Sep 18, 2003, in forum: ASP General
    Replies:
    1
    Views:
    176
    Ray at
    Sep 18, 2003
  5. Lord Merlin
    Replies:
    8
    Views:
    407
    Lord Merlin
    Apr 21, 2004
Loading...

Share This Page