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


##########
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:
   @LeonYoah @davidzollo 
   The setTimestamp() method uses the JVM's default time zone instead of the 
database time zone or UTC. Could modifying the time zone like this cause 
problems?



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