This means the JDBC driver you're using does not support the use of
the two-argument setObject() call when the object is a PGVector. Did
you register the Vector type by calling:

PGvector.addVectorType(conn);

The documentation [1] says that the two-argument setObject() should
work if you have registered the Vector type.

Regards,
Matt

[1] https://github.com/pgvector/pgvector-java

On Thu, Aug 31, 2023 at 12:01 PM Mark Payne <marka...@hotmail.com> wrote:
>
> Hey Uwe,
>
> The DBCPConnectionPool returns a java.sql.Connection. From that you’d create 
> a Statement. So I’m a little confused when you say that you’ve got it working 
> in Pure JDBC but not with NiFi, as the class returned IS pure JDBC. Perhaps 
> you can share a code snippet of what you’re doing in the “Pure JDBC” route 
> that is working versus what you’re doing in the NiFi processor that’s not 
> working?
>
> Thanks
> -Mark
>
>
> > On Aug 31, 2023, at 10:58 AM, u...@moosheimer.com wrote:
> >
> > Hi,
> >
> > I am currently writing a processor to write OpenAI embeddings to Postgres.
> > I am using DBCPConnectionPool for this.
> > I use Maven to integrate PGVector (https://github.com/pgvector/pgvector).
> >
> > With pure JDBC this works fine. With the database classes from NiFi I get 
> > the error:
> > *Cannot infer the SQL type to use for an instance of com.pgvector.PGvector. 
> > Use setObject() with an explicit Types value to specify the type to use.*
> >
> > I use -> setObject (5, new PGvector(embeddingArray)).
> > embeddingArray is defined as: float[] embeddingArray
> >
> > Of course I know why I get the error from NiFi and not from the JDBC 
> > driver, but unfortunately this knowledge does not help me.
> >
> > Can anyone tell me what SQLType I need to specify for this?
> > I have searched the internet and the NiFi sources on GitHub for several 
> > hours now and have found nothing.
> >
> > One option would be to use native JDBC and ignore the ConnectionPool. But 
> > that would be a very bad style in my opinion.
> > Perhaps there is a better solution?
> >
> > Any help, especially from Matt B., is appreciated as I'm at a loss.
> > Thanks guys.
>

Reply via email to