The Exasol driver lets Node.js and browser applications connect to Exasol and execute SQL.
Use @exasol/exasol-driver-ts in Node.js for the complete API, including local file import and export. Use @exasol/exasol-driver-ts/browser in browser applications; it exports the driver and pool core without Node.js file or TLS modules. Both entry points require an explicit WebSocket factory.
GitHub repository · User guide
ExasolDriver.Import from @exasol/exasol-driver-ts/browser for browser-compatible database access. This entry point excludes local file import/export and Node.js TLS modules.
Install the driver and the Node.js WebSocket implementation:
npm install @exasol/exasol-driver-ts ws @types/ws
Connect, execute a query, and close the driver when finished:
import { ExasolDriver, ExaWebsocket } from '@exasol/exasol-driver-ts';
import { WebSocket } from 'ws';
const driver = new ExasolDriver(
(url) => new WebSocket(url) as ExaWebsocket,
{ host: 'localhost', port: 8563, user: 'sys', password: 'exasol' },
);
await driver.connect();
await driver.query('SELECT * FROM EXA_ALL_SCHEMAS');
await driver.close();
Install the driver; browsers provide the WebSocket implementation:
npm install @exasol/exasol-driver-ts
Use the browser entry point and the runtime-native WebSocket:
import { ExasolDriver, ExaWebsocket } from '@exasol/exasol-driver-ts/browser';
const driver = new ExasolDriver(
(url) => new WebSocket(url) as ExaWebsocket,
{ host: 'localhost', port: 8563, user: 'sys', password: 'exasol' },
);
await driver.connect();
await driver.query('SELECT * FROM EXA_ALL_SCHEMAS');
await driver.close();