[
https://issues.apache.org/jira/browse/KNOX-3202?focusedWorklogId=997096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-997096
]
ASF GitHub Bot logged work on KNOX-3202:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Dec/25 12:54
Start Date: 19/Dec/25 12:54
Worklog Time Spent: 10m
Work Description: hanicz opened a new pull request, #1134:
URL: https://github.com/apache/knox/pull/1134
…ls into DataSourceFactory
[KNOX-3202](https://issues.apache.org/jira/browse/KNOX-3202) - Add support
for Oracle DB as a Token State backend
## What changes were proposed in this pull request?
- Added `com.oracle.database.jdbc.ojdbc11` dependency [FDHUT
license](https://download.oracle.com/otn-pub/otn_software/jdbc/FDHUT_LICENSE.txt?AuthParam=1766128282_8dc11b81b7f2e6b326377dd9a559a1c9).
- Refactored `JDBCUtils` into factory pattern so every class has its clear
responsibilities.
- Introduced a new enum for database types.
- Created new sql files to separate derby, oracle and common DDL scripts.
This removes the on-the-fly replace calls on a single DDL script.
- Added new unit tests for Oracle database type.
## How was this patch tested?
`mvn clear verify`
Below manual tests:
I started up Knox with a specific database type, created a new token,
queried that token on the token management UI and also verified in the DB.
Tested oracle, derby, mysql, postgres and mariadb locally with docker images
Oracle: `gvenzl/oracle-free` `jdbc:oracle:thin:localhost:1521/FREEPDB1`
MariaDB: `mariadb:11`
`jdbc:mariadb://127.0.0.1:3306/testdb?user=testuser&password=testpass`
MySQL: `mysql:8.4`
PostgreSQL: `postgres:16`
Oracle:
```
<property>
<name>gateway.service.tokenstate.impl</name>
<value>org.apache.knox.gateway.services.token.impl.JDBCTokenStateService</value>
</property>
<property>
<name>gateway.database.type</name>
<value>oracle</value>
</property>
<property>
<name>gateway.database.port</name>
<value>1521</value>
</property>
<property>
<name>gateway.database.host</name>
<value>localhost</value>
</property>
<property>
<name>gateway.database.name</name>
<value>FREEPDB1</value>
</property>
OR
<property>
<name>gateway.database.connection.url</name>
<value>jdbc:oracle:thin:localhost:1521/FREEPDB1</value>
</property>
```
```
install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh generate-jwk --saveAlias
knox.token.hash.key
install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh create-aliases --alias
gateway_database_user --value SYSTEM --alias gateway_database_password --value
test
install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh create-aliases --alias
gateway_database_user --value appuser --alias gateway_database_password --value
apppass
```
<img width="1873" height="754" alt="Screenshot 2025-12-19 at 8 29 50"
src="https://github.com/user-attachments/assets/687baf0e-3cd9-4d39-b34e-fde93e005e88"
/>
<img width="1906" height="385" alt="Screenshot 2025-12-19 at 8 29 57"
src="https://github.com/user-attachments/assets/ed4103b1-bb57-478c-9388-4c5911cce804"
/>
Issue Time Tracking
-------------------
Worklog Id: (was: 997096)
Remaining Estimate: 0h
Time Spent: 10m
> Add support for Oracle DB as a Token State backend
> --------------------------------------------------
>
> Key: KNOX-3202
> URL: https://issues.apache.org/jira/browse/KNOX-3202
> Project: Apache Knox
> Issue Type: Improvement
> Components: Server
> Affects Versions: 2.0.0, 1.6.0, 1.6.1, 2.1.0
> Reporter: Sandor Molnar
> Assignee: Tamás Hanicz
> Priority: Major
> Fix For: 3.0.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The currently supported JDBC TSS backends are:
> * PostgreSQL
> * MySQL
> * MariaDB
> * Derby (the default TSS implementation)
> * HSQL (used by our tests)
> Oracle DB is a well-known and frequently-used RDBMS, which Knox should
> support as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)