Repository navigation
Commit 8deada7
[fix](jdbc) Set the Oracle driver's session time zone only for Oracle catalogs
### What problem does this PR solve?
Issue Number: None
Related PR: #68786
Problem Summary:
#68786 made `OracleTypeHandler.initializeStatement` set the session time
zone of every borrowed connection to UTC through Oracle's driver
(`oracle.jdbc.OracleConnection#setSessionTimeZone`, loaded reflectively
from the driver's class loader), so that the driver reads TIMESTAMP WITH
LOCAL TIME ZONE as an instant. `JdbcTypeHandlerFactory` gives the same
handler to an Oracle-mode OceanBase catalog (`OCEANBASE_ORACLE`), which
connects through OceanBase's driver. Its class loader has no
`oracle.jdbc` classes, so every scan of such a catalog failed before its
query was prepared, with "Failed to initialize Oracle session time zone"
caused by a ClassNotFoundException, whatever columns it read. Writes were
not affected.
The handler now takes the table type, as `MySQLTypeHandler` does, and
sets the Oracle session time zone only for an Oracle catalog. An
Oracle-mode OceanBase catalog prepares its statements as it did before
#68786, and reads TIMESTAMP WITH LOCAL TIME ZONE as OceanBase's driver
returns it.
### Release note
Fix scans of Oracle-mode OceanBase JDBC catalogs failing with "Failed to initialize Oracle session time zone".
### Check List (For Author)
- Test: Unit Test (OracleSessionTimeZoneTest; all jdbc-scanner tests). No end-to-end test: OceanBase's Oracle mode is only in its enterprise edition, and the regression environment runs OceanBase CE in MySQL mode.
- Behavior changed: No
- Does this need documentation: No
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent f605375 commit 8deada7
3 files changed
Lines changed: 59 additions & 11 deletions
File tree
- fe/be-java-extensions/jdbc-scanner/src
- main/java/org/apache/doris/jdbc
- test/java/org/apache/doris/jdbc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | | - | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | | - | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
71 | 111 | | |
0 commit comments