0

Im trying to bind array fields in spanner using java reactive programming and using r2dbc spi binds https://r2dbc.io/spec/0.8.0.RELEASE/api/io/r2dbc/spi/Statement.html

I'm encountering this exception com.google.cloud.spanner.r2dbc.BindingFailureException: Can't find a binder for type: class [Ljava.lang.String

We can use binds for array fields in spanner as mentioned here How to bind to IN parameters in Cloud Spanner Java API

But this bind works only spanner statements but not for r2dbc

johnnesto
  • 31
  • 1
  • 4
  • Are you using MySQL or Cloud Spanner? If Cloud Spanner, support for arrays was [added after the last release](https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc/pull/495), and at this point will be released for SPI v0.9 and 1.0. – Elena Felder Jun 02 '22 at 13:19
  • @ElenaFelder Despite updating both spanner r2dbc and r2dbc-spi to their latest versions, Im still noticing the same error. ```com.google.cloud.spanner.r2dbc.BindingFailureException: Can't find a binder for type: class io.r2dbc.spi.Parameters$InParameter``` Im trying to bind them like this ```.bind(arrayField, Parameters.in(R2dbcType.COLLECTION, arrayValues[]))``` Do you know if spanner really supports it? – johnnesto Jun 06 '22 at 12:16
  • Cloud Spanner supports it, but the Cloud Spanner R2DBC support has not been released yet. – Elena Felder Jun 06 '22 at 14:15
  • @ElenaFelder so is there no way to bind arrays without using cloud spanner ? – johnnesto Jun 06 '22 at 14:43
  • @ElenaFelder and also is it possible to integrate spanner and r2dbc-spi – johnnesto Jun 06 '22 at 14:52
  • The way to integrate Cloud Spanner and R2DBC is https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc . However, we have not released support for array binding yet, so it is not currently possible. – Elena Felder Jun 06 '22 at 16:01
  • I am not sure what you mean by " so is there no way to bind arrays without using cloud spanner" -- do you mean you are choosing between different databases? – Elena Felder Jun 06 '22 at 16:02
  • I am not sure what you mean by " so is there no way to bind arrays without using cloud spanner" -- do you mean you are choosing between different databases? No I mean unless we use native cloud spi, is there no way for us to bind arrays currently? – johnnesto Jun 06 '22 at 17:20
  • If you mean R2DBC SPI, it requires a database-specific driver. The latest release of Cloud Spanner R2DBC driver does not have this functionality yet, so yes, currently there is no way. – Elena Felder Jun 06 '22 at 17:26
  • Thanks for the confirmation. Appreciate your time – johnnesto Jun 06 '22 at 17:27
  • You could use Cloud Spanner client library's async API to bind arrays, but it's complex. – Elena Felder Jun 06 '22 at 17:27

1 Answers1

-1

cloud-spanner-r2dbc@v1.2.0 added support for binding arrays and lists to Spanner native arrays.