Page 1 of 1

java.sql.SQLDataException: A truncation error was encountere

PostPosted: Mon Jan 08, 2024 11:20 pm
by carsten
Hi,
sometimes i get a truncation error and the files are not added to the library-
I saw that you already increased the length of the varchar field about 10 years ago.
Maybe it's better to us a blob?

org.serviio.db.dao.PersistenceException: Cannot create Video with title XXX
at org.serviio.library.dao.VideoDAOImpl.create(VideoDAOImpl.java:117) ~[serviio.jar:?]
at org.serviio.library.dao.VideoDAOImpl.create(VideoDAOImpl.java:43) ~[serviio.jar:?]
at org.serviio.library.local.service.VideoService.addVideoToLibrary(VideoService.java:124) ~[serviio.jar:?]
at org.serviio.library.local.indexing.MediaFileIndexer.addNewMediaFile(MediaFileIndexer.java:87) ~[serviio.jar:?]
at org.serviio.library.local.indexing.DefaultLibraryMonitor.fileAdded(DefaultLibraryMonitor.java:52) ~[serviio.jar:?]
at org.serviio.library.local.indexing.pipe.PipeManager$PipeProcessingConsumer.lambda$run$0(PipeManager.java:174) ~[serviio.jar:?]
at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_352]
at org.serviio.library.local.indexing.pipe.PipeManager$PipeProcessingConsumer.run(PipeManager.java:169) ~[serviio.jar:?]
at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_352]
Caused by: java.sql.SQLDataException: A truncation error was encountered trying to shrink VARCHAR '3/SRT/ger/true,4/SRT/ger/false,5/SRT/ger/false,6/SRT/ara/fal&' to length 1024.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source) ~[derby.jar:?]
at org.serviio.library.dao.VideoDAOImpl.create(VideoDAOImpl.java:114) ~[serviio.jar:?]
... 8 more
Caused by: org.apache.derby.iapi.error.StandardException: A truncation error was encountered trying to shrink VARCHAR '3/SRT/ger/true,4/SRT/ger/false,5/SRT/ger/false,6/SRT/ara/fal&' to length 1024.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby.jar:?]
at org.apache.derby.iapi.types.SQLChar.hasNonBlankChars(Unknown Source) ~[derby.jar:?]
at org.apache.derby.iapi.types.SQLVarchar.normalize(Unknown Source) ~[derby.jar:?]
at org.apache.derby.iapi.types.SQLVarchar.normalize(Unknown Source) ~[derby.jar:?]
at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeColumn(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.InsertResultSet.getNextRowCore(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source) ~[derby.jar:?]
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source) ~[derby.jar:?]
at org.serviio.library.dao.VideoDAOImpl.create(VideoDAOImpl.java:114) ~[serviio.jar:?]
... 8 more

Re: java.sql.SQLDataException: A truncation error was encoun

PostPosted: Tue Mar 05, 2024 5:14 am
by Brenj0r
I stumbled across this exact situation too. The file you are adding to the library has too many subtitles. I have an MKV with 40 subtitle languages & it indexed fine. I had an MKV with 65 subtitle tracks & it had that error.

You need to remove some of the subtitles so the subtitle data can be inserted into the database.

I had an MKV file so I downloaded MKVToolNix & used mkvtoolnix-gui.exe. I dragged the MKV into the gui & deselected about 50 subtitle tracks in the multiplexer tab. After changing the destination file name, start multpiplexing, the movie added in fine.

Maybe the varchar field needs another increase.