Integration Studio - Cannot publish extension, string/binary data would be truncated

I'm using the free edition of OutSystems with the in-cloud environment. My question is about creating an Integration Studio Extension to connect to a MySQL database hosted elsewhere. The extension is for the .NET application server, targeting DMBS '(All)'.

I've successfully created such an extension before, so I know that in principle everything is set up correctly, but am having problems republishing the extension now that the database has new tables. I've looked at a lot of the posts for the "string or binary data would be truncated" error, and they all seem to relate to adding new records to / editing records in the database - at the moment I'm not doing that, I'm just trying to publish the extension. But the new database tables do have fields with datatypes I haven't used before, so I'm guessing this is where the problem lies.

I have several fields which might be relevant, but the error message I'm getting doesn't point me in any particular direction. I have fields in the MySQL database of type varchar(12), varchar(25), varchar(255), varchar(4000), mediumblob and enum. However these all seem to be mapped sensibly to OutSystems Data types, with the correct Length filled out in the entities generated.

The extension verifies, saves and uploads just fine, but will not publish. The error message is pasted below. I've tried several alterations to see if I can get it working, and read every post I can find on this error, but nothing seems to address the problem. Does anyone know what might need changing?

For what it's worth, if the problem is something fundamentally about the length of the 4000 character string fields or the mediumblob binary fields, I probably do have flexibility to make the underlying database fields shorter - it's not hassle free, but I can probably do so without losing data.

Many thanks in advance!


Error message on publish:


An error occurred while publishing the Extension: System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.
  at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
  at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
  at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
  at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
  at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
  at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
  at OutSystems.HubEdition.Extensibility.Data.ExecutionService.BaseExecutionService.ExecuteNonQuery(IDbCommand cmd)
  at OutSystems.Internal.Db.Command.ExecuteNonQuery(String description, Boolean isApplication, Boolean skipLog, Boolean applyTransformationsToParameters)
  at OutSystems.HubEdition.ServerCommon.Database.DBCommon.CreateEntityAttr(Transaction tran, Int32 entityId, String name, String description, ObjectKey ssKey, String type, Int32 length, Int32 decimals, Boolean mandatory, Boolean autoNumber, String defaultValue, Int32 order, String originalType, String databaseName)
  at #cwc.#Gwc.PublishExtension(ExtensionCaches extensionCaches, OutSystemsCompilerWrapper outSystemsCompilerWrapper, Int32 extensionVersionId, Int32 developerId, Boolean switchPublishedVersion, ICompilerContext context, Boolean fromSolutionPublish, String& extensionName, HEMessageArrayList& messages)
Error Number:8152,State:13,Class:16

Okay, I've narrowed down the problem. This is actually nothing to do with the blob or varchar fields - it's the enum field. Here's a minimal test case that recreates the issue:

CREATE TABLE `mysqldbname`.`testenum`
   `Type` ENUM('Box', 'Case', 'Cupboard', 'Drawer', 'Folder', 'Frame', 'Loose', 'Other', 'Shelf') NOT NULL,

When you import this table in Integration Studio, you get the following:

Name: ID
Original Name: ID
Original Type: int(11)
Data Type: Integer
Ignore: False
Mandatory: True
Auto Generated: True

Name: Type
Original Name: Type
Original Type: enum('Box','Case','Cupboard','Drawer','Folder','Frame','Loose','Other','Shelf')
Data Type: Text
Length: 8
Ignore: False
Mandatory: True
Auto Generated: False

It's this entity that won't publish with the error message above.

Obviously the auto-inserted "Length 8" appears to be adequate superficially. It doesn't appear that any truncation could occur. However for the sake of argument, changing the "Length" setting to 50, or to 2, or to 255, makes no difference.

So it seems like something is fundamentally wrong with the treatment of the enum. Any ideas? Has anyone successfully created an Extension that maps a MySQL enum column? Thanks again!

Hi Ian and Angela,

I have exactly the same issue at the moment.  Did not even think that the enums could cause the problem!

Did you find a solution at the end?

Thank you :)