Registry / database / sqlanywhere

sqlanywhere

JSON →
library1.0.27jsnpmunverified

Node.js native driver for SAP SQL Anywhere databases, supporting direct execution, prepared statements, and connection pooling. Latest version 1.0.27 supports Node.js 5–12, but development appears stalled with no releases since 2019. Requires native compilation via node-gyp; prebuilt binaries only for Windows 64-bit. Compared to generic ODBC drivers, this offers tighter integration with SQL Anywhere-specific features like auto-starting databases and connection properties, but at the cost of limited platform and Node version support. The API is callback-based; no Promise or async/await support.

npm install sqlanywhere
INSTALL
IMPORT
SIG · SQLANYWHERE
S
sqlanywhere
databasejavascriptv1.0.27
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sqlanywhere
const sqlanywhere = require('sqlanywhere');
import sqlanywhere from 'sqlanywhere';
The package is CJS-only; ESM import will fail because there is no default export.
createConnection
const conn = sqlanywhere.createConnection();
const conn = new sqlanywhere.Connection();
createConnection is a factory function, not a constructor. Do not use 'new'.
connect
conn.connect({ Server: 'demo', UserId: 'DBA', Password: 'sql' }, callback);
conn.connect('Server=demo;UserId=DBA;Password=sql', callback);
Connection parameters must be passed as an object, not a connection string.

Connect to a SQL Anywhere database and execute a parameterized query with a callback.

const sqlanywhere = require('sqlanywhere'); const conn = sqlanywhere.createConnection(); const conn_params = { Server: 'demo16', UserId: 'DBA', Password: 'sql' }; conn.connect(conn_params, (err) => { if (err) throw err; conn.exec('SELECT Name, Description FROM Products WHERE id = ?', [301], (err, result) => { if (err) throw err; console.log('Name:', result[0].Name, ', Description:', result[0].Description); conn.disconnect(); }); });
Debug
Known issues
gotchaThe package only ships precompiled native binaries for Windows 64-bit. On Linux or macOS, you must have a full C++ toolchain and SQL Anywhere client SDK installed to compile from source.
fix
Install node-gyp and ensure SQL Anywhere SDK is available. Alternatively, use a cross-platform ODBC driver.
affects: >=1.0.0
deprecatedLTS releases of Node.js beyond version 12 (e.g., 14, 16, 18) are not supported. The last release (1.0.27) only officially supports Node.js 5 through 12.
fix
Use an older Node.js version (12.x) or migrate to a maintained driver like tedious (for MSSQL) or ODBC.
affects: <=1.0.27
gotchaThe callback pattern is inconsistent: conn.exec for DDL returns no result (undefined), for DML returns affectedRows (number), and for queries returns an array of rows. Mixing these up can cause runtime errors.
fix
Check the documentation for the type of statement being executed; handle all three cases in your callback.
affects: >=1.0.0
breakingVersion 1.0.24 dropped support for Node.js 0.10, 0.12, and 4.x. Packages relying on those versions will break.
fix
Upgrade Node.js to at least 5.x (max 12.x) or pin to sqlanywhere@1.0.23.
affects: >=1.0.24
Errors
Common errors & fixes
Error: Could not locate the bindings file. Tried: ...
The native addon (sqlanywhere.node) is missing; node-gyp build failed or precompiled binary not available.
fix
Ensure build tools are installed (node-gyp, Python, C++ compiler) and run 'npm rebuild sqlanywhere'. On Windows 64-bit, reinstall the exact version with npm.
Error: connect: database server not found
The connection parameters are incorrect or the SQL Anywhere server is not running on the specified host/port.
fix
Verify server name or Host, and ensure the database server is accessible. For local databases, use DatabaseFile with AutoStart: 'YES'.
TypeError: conn.exec is not a function
The connection object is not properly initialized; likely using an older API version or incorrect import.
fix
Ensure you use 'const sqlanywhere = require('sqlanywhere');' and then 'const conn = sqlanywhere.createConnection();'. The exec method is only available after createConnection.
Upgrade
Version history
1.0.27latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Meta
1
OpenAI (training)
1
Resources
sqlanywhere — npm install sqlanywhere · libregistry