Sign inSign up

sergey12313/node-odbc-sybase

By sergey12313

•Updated over 1 year ago

Node.js Sybase databases using ODBC.

Image
0

315

sergey12313/node-odbc-sybase repository overview

⁠Node.js ODBC Sybase Connection

This project provides a Docker-based solution for connecting Node.js applications to Sybase databases using ODBC.

⁠Configuration Options

There are two ways to configure the database connection:

⁠1. Mount Configuration Files

Mount the following configuration files:

⁠/etc/freetds/freetds.conf
[global]
[DSN]
charset = cp1251
host = DB_HOST
port = DB_PORT
tds version = 5.0
⁠/etc/odbc.ini
[DSN]
DRIVER=FreeTDS
SERVER=DB_HOST
PORT=DB_PORT
TDS_Version = 5.0
⁠2. Using Dockerfile

Create a Dockerfile with the following content:

FROM sergey12313/node-odbc-sybase

ARG DB_USER
ARG DB_PASSWORD
ARG DB_HOST
ARG DB_PORT=5000
ARG DSN=SYBASE_MAIN

ENV DB_USER=${DB_USER}
ENV DB_PASSWORD=${DB_PASSWORD}
ENV DB_HOST=${DB_HOST}
ENV DB_PORT=${DB_PORT}
ENV DSN=${DSN}

COPY package*.json ./
COPY tsconfig.json ./
RUN npm install --only=development
COPY src src
RUN npm run build
RUN npm ci --omit=dev
RUN /usr/local/bin/init-config.sh

CMD ["node", "dist/index.js"]

⁠Building the Image

Build the Docker image using the following command:

docker build \
  --build-arg DB_USER=your_user \
  --build-arg DB_HOST=your_host \
  --build-arg DB_PORT=your_port \
  -t my-app .

⁠Running the Container

Run the container with the following command:

docker run \
  -e DB_USER=your_user \
  -e DB_PASSWORD=your_password \
  -e DB_HOST=your_host \
  -e DB_PORT=your_port \
  my-app

⁠Environment Variables

VariableDescriptionDefault
DB_USERDatabase username-
DB_PASSWORDDatabase password-
DB_HOSTDatabase host-
DB_PORTDatabase port5000
DSNData Source NameSYBASE_MAIN

⁠Notes

  • The configuration files are automatically generated using the provided environment variables
  • The FreeTDS driver is configured to use TDS version 5.0
  • Character encoding is set to cp1251 for proper Russian language support

Tag summary

Content type

Image

Digest

sha256:2aa715548…

Size

63.5 MB

Last updated

over 1 year ago

docker pull sergey12313/node-odbc-sybase