on 07-24-2023 10:46 AM
While connecting to SYBASE using docker-compose run with typescript is failing with [Error: Code: -100 Msg: Database server not found].
ts file:
console.log("SqlAnywhere testing"); var sqlanywhere2 = require('sqlanywhere');
var conn = sqlanywhere2.createConnection();
// const DB_NAME = process.env.SYBASE_DB as string; const SYBASE_USER = process.env.SYBASE_USER as string;const SYBASE_PASSWORD = process.env.SYBASE_PASSWORD as string;// const HOST = process.env.SYBASE_HOST as string;// const PORT = Number(process.env.SYBASE_PORT);
var conn_params = { Server : '****', // UserId : 'DBA', // Password: 'sql' Host : 'localhost:49152', // PrefetchBuffer='8M', // PrefetchRows=10000};
conn.connect(conn_params, function (err: any) { console.log("1"); if (err) throw err; console.log("2"); conn.exec('SELECT Name, Description FROM Products WHERE id = ?', [301], function (err: any, result: any) { console.log("3"); if (err) throw err; console.log("4"); console.log('Name: ', result[0].Name, ', Description: ', result[0].Description); // output --> Name: Tee Shirt, Description: V-neck conn.disconnect(); }) });
package.json{ "name": "nodejsprogram", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "local": "nodemon -L ./src/Main.ts" },
"keywords": [], "author": "", "license": "ISC", "dependencies": { "sqlanywhere": "^2.0.12" }, "devDependencies": { "@types/node": "^20.2.0", "@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/parser": "^5.59.6", "eslint": "^8.40.0", "eslint-plugin-import": "^2.27.5", "nodemon": "^2.0.22", "rimraf": "^5.0.1", "ts-loader": "^9.4.2", "ts-node": "^10.9.1", "typescript": "^5.0.4", "webpack": "^5.83.1", "webpack-cli": "^5.1.1"}}
Please someone help to resolve this
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.