Error while Importing LDAP data: SQLServerException: String or binary data would be truncated

Issue

  • LDAP import fails due to an error stating that the user could not be updated due to a DataException,  which is in turn caused by a SQLServerException, stating that String or binary data would be truncated.
  • Please refer below for an example of the error:

    ERROR [liferay/scheduled_user_ldap_import-1][LDAPUserImporterImpl:817] Unable to import user CN=Fake Name,OU=STU,OU=UserAccounts,OU=Tier2,OU=FakeCompany: null:null:{samaccountname=sAMAccountName: Fake.Name}

    org.springframework.dao.DataIntegrityViolationException: could not update: [com.liferay.portal.model.impl.UserImpl#9999999]; SQL [update User_ set mvccVersion=?, modifiedDate=?, jobTitle=? where userId=? and mvccVersion=?]; nested exception is org.hibernate.exception.DataException: could not update: [com.liferay.portal.model.impl.UserImpl#9999999]
    (...)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

Environment

  • DXP 7.0

Resolution

  • The issue occurs because a column in the LDAP data being imported contains more characters than is allowed for that matching column in the database.  
  • To resolve this issue, you could create and use Custom Fields or,  you can reduce the character count of the offending column. 
  • To reduce the character count, you can review the data of the CN named in the error and check the character limits for all the columns in the database, and cross-reference it to the character count of the contents of the LDAP columns. 
  • Please note that we discourage changing the character limits in your database, as this could cause upgrade issues further down the line. 




这篇文章有帮助吗?
0 人中有 0 人觉得有帮助