w4rdy opened a new issue, #1512:
URL: https://github.com/apache/camel-kafka-connector/issues/1512

   Hi there,
   
   We're trying to insert a jsonb value into our Postgres database but we're 
coming across the following error:
   ```
   Setting SQL statement parameter value: column index 2, parameter value 
[{common=1.0.0}], value class [java.util.LinkedHashMap], SQL type unknown 
(org.springframework.jdbc.core.StatementCreatorUtils:227)
   ``` 
   I assume it's because the placholder is being replaced with the actual map, 
rather than a map escaped with single quotes (how you would normally insert a 
json element into a table). 
   
   Do you have any ideas to get around this? I've tried casting it to a jsonb 
value and also using the Postgres `to_json` function but no luck.
   
   Thanks!
   
   ___________
   
   We have the table schema:
   ```SQL
   CREATE TABLE software_versions (
       id VARCHAR(64) PRIMARY KEY NOT NULL,
       versions JSONB NOT NULL
   )
   ```
   
   Connector config:
   ```json
   {
       "name": "postgres-sink-connector",
       "config": {
           "connector.class": 
"org.apache.camel.kafkaconnector.postgresqlsink.CamelPostgresqlsinkSinkConnector",
           "tasks.max": "1",
            "topics": "software_versions",
            "value.converter": 
"org.apache.kafka.connect.storage.StringConverter",
            "camel.kamelet.postgresql-sink.username": "postgres",
            "camel.kamelet.postgresql-sink.password": "postgres",
            "camel.kamelet.postgresql-sink.serverName": "postgres",
            "camel.kamelet.postgresql-sink.serverPort": "5432",
            "camel.kamelet.postgresql-sink.databaseName": "versions",
            "camel.kamelet.postgresql-sink.query": "INSERT INTO 
software_versions (id, versions) VALUES (:#id, :#versions);"
       }
   }
   ```
   And we're consuming the following message from the topic:
   ```json
   {
       "id" : "id_1",
       "versions" : {
           "common" : "1.0.0"
       }
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to