LeonYoah commented on code in PR #10428:
URL: https://github.com/apache/seatunnel/pull/10428#discussion_r2759656973


##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleConnectionUtils.java:
##########
@@ -84,6 +84,39 @@ public static RedoLogOffset 
currentRedoLogOffset(JdbcConnection jdbc) {
         }
     }
 
+    /**
+     * Convert timestamp (milliseconds since epoch) to Oracle SCN.
+     *
+     * @param jdbc JDBC connection
+     * @param timestampMs timestamp in milliseconds since epoch
+     * @return RedoLogOffset with the corresponding SCN
+     */
+    public static RedoLogOffset timestampToScn(JdbcConnection jdbc, long 
timestampMs) {
+        try {
+            LOG.info("Converting timestamp {} to SCN", timestampMs);
+            String sql = "SELECT TIMESTAMP_TO_SCN(?) AS SCN FROM DUAL";
+            return jdbc.prepareQueryAndMap(
+                    sql,
+                    statement -> {
+                        java.sql.Timestamp timestamp = new 
java.sql.Timestamp(timestampMs);
+                        statement.setTimestamp(1, timestamp);

Review Comment:
   I noticed that the MySQL CDC has a "server-time-zone" parameter. We should 
allow users to specify or debug how to handle it. After all, it's quite 
challenging to ensure compatibility with both time zones. 
   ```java
   // Pass in serverTimeZone when calling 
   Calendar calendar = 
Calendar.getInstance(TimeZone.getTimeZone(serverTimeZone));
   statement.setTimestamp(1, timestamp, calendar);
   ```



-- 
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