Reputation: 1
Dockerfile
FROM node:20.11.1-alpine AS alpine
RUN apk add --no-cache \
tzdata libaio libnsl libc6-compat
COPY ./src/instantclient-basiclite-linux.x64-23.4.0.24.05.zip /tmp/instantclient-basiclite.zip
WORKDIR /tmp
RUN unzip instantclient-basiclite.zip
RUN mv instantclient*/ /usr/lib/instantclient && \
rm instantclient-basiclite.zip && \
ln -s /usr/lib/instantclient/libclntsh.so.23.1 /usr/lib/libclntsh.so && \
ln -s /usr/lib/instantclient/libclntshcore.so.23.1 /usr/lib/libclntshcore.so && \
ln -s /usr/lib/instantclient/libocci.so.23.1 /usr/lib/libocci.so && \
ln -s /usr/lib/instantclient/libociicus.so /usr/lib/libociicus.so && \
ln -s /usr/lib/instantclient/libnnz.so /usr/lib/libnnz.so && \
ln -s /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 && \
ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \
ln -s /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2
ENV DPI_DEBUG_LEVEL 64
ENV LD_LIBRARY_PATH /usr/lib/instantclient
WORKDIR /app
# Define the command to run the application
CMD ["node", "index.js >2 log.txt"]
index.js
const oracledb = require("oracledb");
oracledb.initOracleClient();
const connection = await oracledb.getConnection({
user: "system",
password: "test123",
connectString : "localhost:1521/FREEPDB1"
});
console.log('ORACLEDB connection() END', connection);
Unable to connect to oracledb with initOracleClient()
, but works OK without initOracleClient()
log.txt
ODPI [00214] 2024-10-04 03:21:55.014: module name is /app/node_modules/.pnpm/[email protected]/node_modules/oracledb/build/Release/oracledb-6.6.0-linux-x64.node
ODPI [00214] 2024-10-04 03:21:55.014: load in dir /app/node_modules/.pnpm/[email protected]/node_modules/oracledb/build/Release
ODPI [00214] 2024-10-04 03:21:55.014: load with name /app/node_modules/.pnpm/[email protected]/node_modules/oracledb/build/Release/libclntsh.so
ODPI [00214] 2024-10-04 03:21:55.014: load by OS failure: Error loading shared library /app/node_modules/.pnpm/[email protected]/node_modules/oracledb/build/Release/libclntsh.so: No such file or directory
ODPI [00214] 2024-10-04 03:21:55.014: load with OS search heuristics
ODPI [00214] 2024-10-04 03:21:55.014: load with name libclntsh.so
ODPI [00214] 2024-10-04 03:21:55.027: load by OS successful
ODPI [00214] 2024-10-04 03:21:55.027: validating loaded library
AppDataSource error [Error: ORA-24960: the attribute OCI_ATTR_PASSWORD is greater than the maximum allowable length of 1024
Help: https://docs.oracle.com/error-help/db/ora-24960/] {
errorNum: 24960,
offset: 0,
code: 'ORA-24960'
}
Expecting the connection to be successful in thickmode too. Followed the steps exactly as mentioned here: https://node-oracledb.readthedocs.io/en/latest/user_guide/initialization.html#enablingthick
Am i missing something here?
Upvotes: 0
Views: 191
Reputation: 1
I was able to solve the same issue by targeting the instant client version to 21.12 instead of the latest 23.4. Try choosing a different instant client package : https://www.oracle.com/sg/database/technologies/instant-client/linux-x86-64-downloads.html
and update the ln -s commands accordingly to 21.1
Upvotes: 0