osalvador / ReplicaDB

ReplicaDB is open source tool for database replication, designed for efficiently transferring bulk data between relational and non-relational databases
https://osalvador.github.io/ReplicaDB/
Apache License 2.0
378 stars 94 forks source link

mysql - mssql #187

Open davegartside opened 2 months ago

davegartside commented 2 months ago

Hello, trying to sync an INT column between mysql and mssql.

I get:

2024-04-23 10:54:27,451 ERROR ReplicaTask:69 ERROR in TaskId-0 inserting data to sink table: [An error occurred while converting the Long value to JDBC data type INTEGER., class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap

varchar works as expected

ReplicaDB-0.15.1-no-oracle.zip Ubuntu 22.04.3 LTS openjdk version "11.0.22" 2024-01-16 OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1) OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing)

Any help gratefully recieved. Thanks.

MichalisDBA commented 2 months ago

Hey @davegartside what is the Column Type of MySQL and MSSQL?

Have you tried to convert the source column to string and transfer it to the sink INT column?

davegartside commented 2 months ago

both column types are int converting it by doing this

source.query=SELECT convert(id,char) FROM glpi_computers

fixes it but feels wrong given they are both the same datatypes...

MichalisDBA commented 2 months ago

I have done something similar from MSSQL to Oracle. As long as the sink Data are correct nothing to worry. I don't know the internal mechanics of jdbc. Maybe @osalvador has an answer to that.