@bytebase/dbhub 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/index.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,6 +98,17 @@ docker run --rm --init \
|
|
|
98
98
|
--dsn "oracle://username:password@localhost:1521/service_name"
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
```bash
|
|
102
|
+
# Oracle example with thick mode for connecting to 11g or older
|
|
103
|
+
docker run --rm --init \
|
|
104
|
+
--name dbhub \
|
|
105
|
+
--publish 8080:8080 \
|
|
106
|
+
bytebase/dbhub-oracle-thick \
|
|
107
|
+
--transport sse \
|
|
108
|
+
--port 8080 \
|
|
109
|
+
--dsn "oracle://username:password@localhost:1521/service_name"
|
|
110
|
+
```
|
|
111
|
+
|
|
101
112
|
### NPM
|
|
102
113
|
|
|
103
114
|
```bash
|
|
@@ -221,6 +232,27 @@ DBHub supports the following database connection string formats:
|
|
|
221
232
|
| SQLite | `sqlite:///[path/to/file]` or `sqlite::memory:` | `sqlite:///path/to/database.db`, `sqlite:C:/Users/YourName/data/database.db (windows)` or `sqlite::memory:` |
|
|
222
233
|
| Oracle | `oracle://[user]:[password]@[host]:[port]/[service_name]` | `oracle://username:password@localhost:1521/service_name` |
|
|
223
234
|
|
|
235
|
+
#### Oracle
|
|
236
|
+
|
|
237
|
+
If you see the error "NJS-138: connections to this database server version are not supported by node-oracledb in Thin mode", you need to use Thick mode as described below.
|
|
238
|
+
|
|
239
|
+
##### Docker
|
|
240
|
+
|
|
241
|
+
Use `bytebase/dbhub-oracle-thick` instead of `bytebase/dbhub` docker image.
|
|
242
|
+
|
|
243
|
+
##### npx
|
|
244
|
+
|
|
245
|
+
1. Download and install [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html) for your platform
|
|
246
|
+
1. Set the `ORACLE_LIB_DIR` environment variable to the path of your Oracle Instant Client:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Set environment variable to Oracle Instant Client directory
|
|
250
|
+
export ORACLE_LIB_DIR=/path/to/instantclient_19_8
|
|
251
|
+
|
|
252
|
+
# Then run DBHub
|
|
253
|
+
npx @bytebase/dbhub --dsn "oracle://username:password@localhost:1521/service_name"
|
|
254
|
+
```
|
|
255
|
+
|
|
224
256
|
#### SQL Server
|
|
225
257
|
|
|
226
258
|
Extra query parameters:
|
package/dist/index.js
CHANGED
|
@@ -1680,6 +1680,16 @@ var OracleConnector = class {
|
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
1682
|
};
|
|
1683
|
+
try {
|
|
1684
|
+
if (process.env.ORACLE_LIB_DIR) {
|
|
1685
|
+
oracledb.initOracleClient({ libDir: process.env.ORACLE_LIB_DIR });
|
|
1686
|
+
console.error("Oracle client initialized in Thick mode");
|
|
1687
|
+
} else {
|
|
1688
|
+
console.error("ORACLE_LIB_DIR not specified, will use Thin mode by default");
|
|
1689
|
+
}
|
|
1690
|
+
} catch (err) {
|
|
1691
|
+
console.error("Failed to initialize Oracle client:", err);
|
|
1692
|
+
}
|
|
1683
1693
|
oracledb.autoCommit = true;
|
|
1684
1694
|
}
|
|
1685
1695
|
async connect(dsn, initializationScript) {
|
|
@@ -1704,6 +1714,19 @@ var OracleConnector = class {
|
|
|
1704
1714
|
}
|
|
1705
1715
|
} catch (error) {
|
|
1706
1716
|
console.error("Failed to connect to Oracle database:", error);
|
|
1717
|
+
if (error instanceof Error && error.message.includes("NJS-138")) {
|
|
1718
|
+
const enhancedError = new Error(
|
|
1719
|
+
`${error.message}
|
|
1720
|
+
|
|
1721
|
+
This error occurs when your Oracle database version is not supported by node-oracledb in Thin mode.
|
|
1722
|
+
To resolve this, you need to use Thick mode:
|
|
1723
|
+
1. Download Oracle Instant Client from https://www.oracle.com/database/technologies/instant-client/downloads.html
|
|
1724
|
+
2. Set ORACLE_LIB_DIR environment variable to the path of your Oracle Instant Client
|
|
1725
|
+
Example: export ORACLE_LIB_DIR=/path/to/instantclient_19_8
|
|
1726
|
+
3. Restart DBHub`
|
|
1727
|
+
);
|
|
1728
|
+
throw enhancedError;
|
|
1729
|
+
}
|
|
1707
1730
|
throw error;
|
|
1708
1731
|
}
|
|
1709
1732
|
}
|