You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Column defined in MSSQL server database as varbinary(MAX),
If bind byte object is greater than 8000 and less than 65535 then fails.
if bind byte object is equal to or less than 8000 then works as expected.
if bind byte object is greater than or equal to 65535 then works as expected.
[3f59d08b-1] There was an unexpected error (type=Internal Server Error, status=500).
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@data"): Data type 0xA5 has an invalid data length or metadata length.
io.r2dbc.mssql.ExceptionFactory$MssqlNonTransientException: [8016] [S00024] The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@data"): Data type 0xA5 has an invalid data length or metadata length.
at io.r2dbc.mssql.ExceptionFactory.createException(ExceptionFactory.java:152)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Handler com.dxc.DCaaS.framework.controller.ApplicationController#insert() [DispatcherHandler]
|_ checkpoint ⇢ HTTP GET "/insert" [ExceptionHandlingWebHandler]
Stack trace:
at io.r2dbc.mssql.ExceptionFactory.createException(ExceptionFactory.java:152)
at io.r2dbc.mssql.ExceptionFactory.createException(ExceptionFactory.java:181)
at io.r2dbc.mssql.RpcQueryMessageFlow.lambda$exchange$1(RpcQueryMessageFlow.java:148)
at reactor.core.publisher.FluxHandle$HandleConditionalSubscriber.onNext(FluxHandle.java:303)
at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:426)
at reactor.core.publisher.EmitterProcessor.onNext(EmitterProcessor.java:268)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:112)
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:242)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:426)
at reactor.core.publisher.EmitterProcessor.onNext(EmitterProcessor.java:268)
at io.r2dbc.mssql.client.ReactorNettyClient$1.next(ReactorNettyClient.java:237)
at io.r2dbc.mssql.client.ReactorNettyClient$1.next(ReactorNettyClient.java:197)
at io.r2dbc.mssql.message.token.Tabular$TabularDecoder.decode(Tabular.java:425)
at io.r2dbc.mssql.client.ConnectionState$4$1.decode(ConnectionState.java:206)
at io.r2dbc.mssql.client.StreamDecoder.withState(StreamDecoder.java:137)
at io.r2dbc.mssql.client.StreamDecoder.decode(StreamDecoder.java:109)
at io.r2dbc.mssql.client.ReactorNettyClient.lambda$new$6(ReactorNettyClient.java:247)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:177)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:220)
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:354)
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:352)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at io.r2dbc.mssql.client.ssl.TdsSslHandler.channelRead(TdsSslHandler.java:402)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Table schema
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Test](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Data] [varbinary](max) NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
INSERT INTO Test (Data) VALUES (@data)
Works
@GetMapping("insert")
public Flux<Integer> insert() throws IOException {
return Mono.from(connectionFactory.create())
.flatMapMany(connection -> Flux.from(connection.createStatement("INSERT INTO Test (Data) VALUES (@data)")
.bind("@data", new byte[65535])
.execute())
.map(Result::getRowsUpdated)
.flatMap(Mono::from)
.doFinally(signalType -> connection.close()));
}
Fails
@GetMapping("insert")
public Flux<Integer> insert() throws IOException {
return Mono.from(connectionFactory.create())
.flatMapMany(connection -> Flux.from(connection.createStatement("INSERT INTO Test (Data) VALUES (@data)")
.bind("@data", new byte[65534])
.execute())
.map(Result::getRowsUpdated)
.flatMap(Mono::from)
.doFinally(signalType -> connection.close()));
}
Steps to reproduce
Column defined in MSSQL server database as varbinary(MAX),
If bind byte object is greater than 8000 and less than 65535 then fails.
if bind byte object is equal to or less than 8000 then works as expected.
if bind byte object is greater than or equal to 65535 then works as expected.
Binary values (byte[]/ByteBuffer) are now correctly encoded using PLP when the data size exceeds 8000 bytes. Previously, the threshold was set to 65535 which rendered value sizes between 8001 and 65534 not usable.
[closes#151]
Bug Report
seems to be discussed on Gitter.im by Tai.Bui @buianhtai Apr 20 17:40 but hasn't been raised
The root causing this issue is the parameter @P0_data to set varbinary ,
It set @P0_data VARBINARY(MAX) when i upload file size >68KB
Versions
spring-data-r2dbc:1.1.0.RC2
r2dbc-mssql:0.8.2.RELEASE
r2dbc-spi:0.8.1.RELEASE
r2dbc-pool:0.8.1.RELEASE
Current Behavior
Column defined in MSSQL server database as varbinary(MAX),
If bind byte object is greater than 8000 and less than 65535 then fails.
if bind byte object is equal to or less than 8000 then works as expected.
if bind byte object is greater than or equal to 65535 then works as expected.
Table schema
Fails
Steps to reproduce
Column defined in MSSQL server database as varbinary(MAX),
If bind byte object is greater than 8000 and less than 65535 then fails.
if bind byte object is equal to or less than 8000 then works as expected.
if bind byte object is greater than or equal to 65535 then works as expected.
Expected behavior/code
Byte object should be inserted correctly into MS SQL table
Possible Solution
Related to #99 think the value should be 8000, not 65535
as varbinary is max 8,000 and varbinary(max) should be used for anything above https://docs.microsoft.com/en-us/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver15
Additional context
The text was updated successfully, but these errors were encountered: