instant client almost working

This commit is contained in:
Matthew Rathbone
2024-02-28 17:28:57 -06:00
parent d088fab852
commit a694c31bcb
6 changed files with 25 additions and 8 deletions

View File

@@ -11,7 +11,6 @@
"scripts": {
"serve": "vue-cli-service serve",
"test:unit": "TEST_MODE=1 ELECTRON_RUN_AS_NODE=1 yarn electron ../../node_modules/jest/bin/jest.js",
"test:integration": "TEST_MODE=1 ELECTRON_RUN_AS_NODE=1 yarn electron ../../node_modules/jest/bin/jest.js --config ./jest.integration.config.js",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve --host localhost --ozone-platform-hint=auto",

View File

@@ -491,15 +491,18 @@ export class OracleClient extends BasicDatabaseClient<DriverResult> {
async connect() {
const cliLocation = this.platformPath(this.server.config.instantClientLocation)
// https://oracle.github.io/node-oracledb/doc/api.html#-152-optional-oracle-net-configuration
const configLocation = this.platformPath(this.server.config.oracleConfigLocation)
console.log("Connecting to oracle")
console.log("CLI LOCATION", cliLocation)
try {
const payload = {}
if (cliLocation) payload['libDir'] = cliLocation
if (configLocation) payload['configDir'] = configLocation
oracle.initOracleClient(payload)
// oracle.initOracleClient(payload)
oracle.initOracleClient()
oracle.fetchAsString = [oracle.CLOB]
oracle.fetchAsBuffer = [oracle.BLOB]
} catch {
@@ -529,9 +532,9 @@ export class OracleClient extends BasicDatabaseClient<DriverResult> {
poolMax: 4,
}
}
console.log("MAKING POOL")
this.pool = await oracle.createPool(poolConfig)
console.log("POOL MADE")
const vSQL = `
SELECT BANNER as BANNER FROM v$version
WHERE BANNER LIKE 'Oracle%';

View File

@@ -13,6 +13,8 @@ describe("Oracle Tests", () => {
beforeAll(async () => {
// this is the testcontainers default startup wait time.
console.log("ENV/ORACLE CLI: ", process.env['ORACLE_CLI_PATH'])
console.log("ENV/LD_LIBRARY_PATH: ", process.env['LD_LIBRARY_PATH'])
const timeoutDefault = 120000
jest.setTimeout(timeoutDefault)
const localDir = path.resolve('./tests/docker/oracle_init')
@@ -39,6 +41,7 @@ describe("Oracle Tests", () => {
client: 'oracle',
host: container.getHost(),
port: container.getMappedPort(1521),
instantClientLocation: process.env['ORACLE_CLI_PATH'],
user: 'beekeeper',
password: 'password',
serviceName: 'BEEKEEPER',
@@ -46,6 +49,7 @@ describe("Oracle Tests", () => {
connectionMethod: 'manual'
}
}
console.log("connecting with config", config)
util = new DBTestUtil(config, "BEEKEEPER", { defaultSchema: 'BEEKEEPER', dialect: 'oracle' })
await util.setupdb()

View File

@@ -11,7 +11,8 @@ then
else
wget -q -O cli.zip \
https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-basic-linux.x64-21.6.0.0.0dbru.zip
# wget -q -O cli.zip \
# https://download.oracle.com/otn_software/linux/instantclient/23c/instantclient-basic-linux.x64-23.3.0.0.0.zip
rm -rf $LOCATION/*
unzip cli.zip -d $LOCATION
fi

View File

@@ -8,7 +8,8 @@ LOCATION="$BASE/.instant"
eval "$BINBASE/get-instant-client.sh '$LOCATION'"
export LD_LIBRARY_PATH="$LOCATION/instantclient_21_6"
export ORACLE_CLI_PATH="$LOCATION/instantclient_21_6/"
export LD_LIBRARY_PATH="$ORACLE_CLI_PATH"
export ELECTRON_RUN_AS_NODE=1
export TEST_MODE=1

View File

@@ -11,7 +11,16 @@ There are a number of ways you can connect to an Oracle database using Beekeeper
2. TSA alias
3. Host and port
## First set Oracle Instant Client location
## Prerequisites
### Linux: Install libaio
```bash
sudo apt-get install libaio1 libaio-dev #debian/ubuntu
sudo yum install libaio #redhat/fedora
```
### Download Oracle Instant Client
Before you can connect to Oracle at all you need to tell Beekeeper where on your computer the Oracle Instant Client libraries are stored. This is a downloadable set of files provided by Oracle.