You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sources/oracle): add Oracle Source and Tool (#1456)
## Description --- > Should include a concise description of the changes (bug or feature), it's > impact, along with a summary of the solution ## PR Checklist --- > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes#488 --------- Co-authored-by: duwenxin <duwenxin@google.com> Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>
Oracle Database is a widely-used relational database management system.
7
+
---
8
+
9
+
## About
10
+
11
+
[Oracle Database][oracle-docs] is a multi-model database management system produced and marketed by Oracle Corporation. It is commonly used for running online transaction processing (OLTP), data warehousing (DW), and mixed (OLTP & DW) database workloads.
12
+
13
+
[oracle-docs]: https://www.oracle.com/database/
14
+
15
+
## Available Tools
16
+
17
+
-[`oracle-sql`](../tools/oracle/oracle-sql.md)
18
+
Execute pre-defined prepared SQL queries in Oracle.
This source uses standard authentication. You will need to [create an Oracle user][oracle-users] to log in to the database with the necessary permissions.
The underlying database driver requires the [Oracle Instant Client][oracle-ic] libraries to connect to the database. These libraries must be installed on the machine where the application is running.
35
+
36
+
After installing the client, ensure the library path is correctly configured for your operating system (e.g., by setting the `LD_LIBRARY_PATH` environment variable on Linux or adding the directory to the `PATH` on Windows) so the application can find the necessary files at runtime.
You can configure the connection to your Oracle database using one of the following three methods. **You should only use one method** in your source configuration.
43
+
44
+
### Basic Connection (Host/Port/Service Name)
45
+
46
+
This is the most straightforward method, where you provide the connection details as separate fields:
47
+
48
+
-`host`: The IP address or hostname of the database server.
49
+
-`port`: The port number the Oracle listener is running on (typically 1521).
50
+
-`serviceName`: The service name for the database instance you wish to connect to.
51
+
52
+
### Connection String
53
+
54
+
As an alternative, you can provide all the connection details in a single `connectionString`. This is a convenient way to consolidate the connection information. The typical format is `hostname:port/servicename`.
55
+
56
+
### TNS Alias
57
+
58
+
For environments that use a `tnsnames.ora` configuration file, you can connect using a TNS (Transparent Network Substrate) alias.
59
+
60
+
-`tnsAlias`: Specify the alias name defined in your `tnsnames.ora` file.
61
+
-`tnsAdmin` (Optional): If your configuration file is not in a standard location, you can use this field to provide the path to the directory containing it. This setting will override the `TNS_ADMIN` environment variable.
62
+
63
+
## Example
64
+
65
+
```yaml
66
+
sources:
67
+
my-oracle-source:
68
+
kind: oracle
69
+
# --- Choose one connection method ---
70
+
# 1. Host, Port, and Service Name
71
+
host: 127.0.0.1
72
+
port: 1521
73
+
serviceName: XEPDB1
74
+
75
+
# 2. Direct Connection String
76
+
connectionString: "127.0.0.1:1521/XEPDB1"
77
+
78
+
# 3. TNS Alias (requires tnsnames.ora)
79
+
tnsAlias: "MY_DB_ALIAS"
80
+
tnsAdmin: "/opt/oracle/network/admin"# Optional: overrides TNS_ADMIN env var
81
+
82
+
user: ${USER_NAME}
83
+
password: ${PASSWORD}
84
+
85
+
```
86
+
87
+
{{< notice tip >}}
88
+
Use environment variable replacement with the format ${ENV_NAME}
89
+
instead of hardcoding your secrets into the configuration file.
| user | string | true | Name of the Oracle user to connect as (e.g. "my-oracle-user"). |
98
+
| password | string | true | Password of the Oracle user (e.g. "my-password"). |
99
+
| host | string | false | IP address or hostname to connect to (e.g. "127.0.0.1"). Required if not using `connectionString` or `tnsAlias`. |
100
+
| port | integer | false | Port to connect to (e.g. "1521"). Required if not using `connectionString` or `tnsAlias`. |
101
+
| serviceName | string | false | The Oracle service name of the database to connect to. Required if not using `connectionString` or `tnsAlias`. |
102
+
| connectionString | string | false | A direct connection string (e.g. "hostname:port/servicename"). Use as an alternative to `host`, `port`, and `serviceName`. |
103
+
| tnsAlias | string | false | A TNS alias from a `tnsnames.ora` file. Use as an alternative to `host`/`port` or `connectionString`. |
104
+
| tnsAdmin | string | false | Path to the directory containing the `tnsnames.ora` file. This overrides the `TNS_ADMIN` environment variable if it is set. |
0 commit comments