I have this connection below. Works well in windows server but when in linux it doesnt. It provides this erro msg :an error occured:> Error: [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101.
when I check on the error code using finderr it says the locale environment variables DB_LOCALE and CLIENT_LOCALE has problem how do I go about this? How can I set the locales or find the problem and solve it. Note that I have installed the CSDK and set the environment varibales as required my connection is as below code.
var ibmdb = require("ifxnjs");
var ConnectionString = "SERVER=ict_tcp;DATABASE=biolive;HOST=128.1.9.144;SERVICE=1541;UID=biouser;PWD=bihif20;";
ibmdb.open(ConnectionString, function (err, connection) {
if (err)
{
console.log("an error occured:> "+err);
return;
}
connection.query("select 1 from mytab1", function (err1, rows)
{
if (err1) console.log(err1);
else console.log(rows);
connection.close(function(err2)
{
if(err2) console.log(err2);
});
});
});
The problem was that my CSDK files were not complete I did not have the gls(global locale support) folder, which provides language support for informix .Incase you know you have set the environment variables properly but still get errors, try checking your CSDK files if all are installed properly or some are missing.
Related
I am trying to run the basic hello world example from the documentation from here (it's the first example on the page):
https://github.com/agracio/edge-js
I have a typescript file that I am running (see the code below). I am on node version 9.9.0 on a Windows 10 64 bit. I have made only the following installations:
npm install edge
npm install edge.js
npm install #types/node --save-dev
I have made the installations to the same directory as the typescript file.
I am able to run ts-node app.ts in the command line and have it console.log("hi") successfully in that directory.
However, when I change my code to the example below, it is giving me the error throw new Error('If .NET source is provided as JavaScript function, function body must be a /* ... */ comment.');
I had originally tried doing this using edge.js but I kept getting the error that I needed to precompile. For the life of me I couldn't get it to find my python executable when executing build.bat release 10.5.3. (Despite including an environment variable PYTHON with a value of c:\Python\Python37\python.exe) I wanted to try using edge-js because it was already precompiled. I downgraded node to 9.9 (I uninstalled node 10.15.3 and then installed the 9.9.0 msi from the website) because I thought edge-js only supported version 9. Well here I am trying to run edge-js with version 9 and I am still getting an error, although it is a different error.
Here is the code I am trying to run:
var edge = require('edge-js');
var helloWorld = edge.func(function () {/*
async (input) => {
return ".NET Welcomes " + input.ToString();
}
*/});
helloWorld('JavaScript', function (error, result) {
if (error) throw error;
console.log(result);
});
I can't believe this worked. It was a syntax error. A problem with the amount of whitespace between the comment and the end of the function. Here is the correct syntax:
var edge = require('edge-js');
var helloWorld = edge.func(function () {
/*async (input) => {
return ".NET Welcomes " + input.ToString();
}*/
});
helloWorld('JavaScript', function (error, result) {
if (error) throw error;
console.log(result);
});
My protractor test cases randomly fail with this error message:
Failed: ECONNREFUSED connect ECONNREFUSED 127.0.0.1
I have gone through the resources and tried all the suggested solutions:
Upgraded protractor
Ran webdriver-manager update
Upgraded chromedriver version but the issue seems to exist.
This particularly happens when I try to run all the e2e tests together.
Below is the specific versions that Im using for my project:
node - v9.2.0
protractor - Version 5.4.1
ChromeDriver 2.42.591088
Please help.
Thanks,
Neeraja
Are you using async/await in your tests?
Can you try applying patch as specified below from the same folder which contains the 'node_modules' folder by executing 'node patch.js'?
patch.js file
var fs = require('fs');
var httpIndexFile = 'node_modules/selenium-webdriver/http/index.js';
fs.readFile(httpIndexFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/\(e.code === 'ECONNRESET'\)/g, "(e.code === 'ECONNRESET' || e.code === 'ECONNREFUSED')");
console.log(`Patching ${httpIndexFile}`)
fs.writeFileSync(httpIndexFile, result, 'utf8');});
var chromeFile = 'node_modules/selenium-webdriver/chrome.js';
fs.readFile(chromeFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/new http.HttpClient\(url\)/g, "new http.HttpClient(url, new (require('http').Agent)({ keepAlive: true }))");
console.log(`Patching ${chromeFile}`)
fs.writeFileSync(chromeFile, result, 'utf8');});
Please see original post here -
https://github.com/angular/protractor/issues/4706#issuecomment-393004887
I've followed the instructions: https://www.ibm.com/developerworks/community/blogs/pd/entry/using_ibm_db2_from_node_js4?maxresults=15&page=0&lang=en
for a 32-bit install of Ubuntu.
It seems to have installed correctly and I can run require('ibm_db'). Using the sample code provided (nodedb2test.js), no matter what database parameters I use I get the error:
node nodedb2test.js
Test program to access DB2 sample database
*** stack smashing detected ***: node terminated
Aborted (core dumped)
Heres the sample code:
/*require the ibm_db module*/
var ibmdb = require('ibm_db');
console.log("Test program to access DB2 sample database");
ibmdb.open("DRIVER={DB2};DATABASE=testdb;UID=username;PWD=password;HOSTNAME=localhost;port=3000", function(err, conn)
{
if(err) {
console.error("error: ", err.message);
}
});
Also I looks the version of DB2 I need to connect to is version 6. I have installed BM Data Server Driver version 10.5, does this correspond to the version of DB2? It appears below v9.1 drivers are not available.
At time of writing this works for me.
C:\Development\Javascript>node -p "process.arch"
x64
C:\Development\Javascript>node -p "process.platform"
win32
C:\Development\Javascript>node -p "process.version"
v14.17.5
C:\Development\Javascript>npm install ibm_db
var ibmdb = require("ibm_db");
const config = require("config");
const hostname = config.get("db2.hostname");
const username = config.get("db2.username");
const password = config.get("db2.password");
ibmdb.open("DRIVER={DB2};DATABASE=bludb;HOSTNAME=" + hostname + ";UID=" + username + ";PWD=" + password + ";PORT=31198;PROTOCOL=TCPIP;SECURITY=SSL", function (err, conn){
if (err) return console.log(err);
conn.query("SELECT * FROM orders", function (err, data) {
if (err) console.log(err);
console.log(data);
conn.close(function () {
console.log('done');
});
});
});
We can use ibm_db without installing IBM Data Server Driver Package too. ibm_db internally uses DB2 V10.5FP5 ODBC/CLI driver to talk to DB2 server. Please share the platform info and OS version where you have installed ibm_db. In june'14, ibm_db was supported on Linuxppc, AIX and zLinux platforms, but latest release is supporting. If latest driver is not working for you, please open an issue on github.com/ibmdb/node-ibm_db/issues/new . Thanks.
I have installed Node.Js and Casper.js to perform webscraping and save the info into a DB. But I have a problem because when I try to execute the source, I get the following error in the terminal:
Error: Cannot find module './build/Release/mysql_bindings'
I have previously installed mysql-libmysqlclient with the mysql_bindings inside. I tested creating the route of the error, but it didn't work.
The code is:
var mysql = require('db-mysql');
new mysql.Database({
hostname: 'localhost',
user: 'rool',
password: 'xxxx',
database: 'xxxBD' }).connect(function(error) {
if (error) {
return console.log('CONNECTION error: ' + error);
}
this.query().
select('*').
from('tablaPruebas').
execute(function(error, rows, cols) {
if (error) {
console.log('ERROR: ' + error);
return;
}
console.log(rows.length + ' ROWS found');
});
});
Thanks in advance!
The problem is that your using the following in your code:
var mysql = require('db-mysql');
However your question shows that you have installed mysql-libmysqlclient. This means you should be using the following instead:
var mysql = require('mysql-libmysqlclient');
I presume you installed from https://github.com/Sannis/node-mysql-libmysqlclient
The code you're using looks more like db-mysql which can be found here
If you install via npm install db-mysql then you should be good. Have a look at the link I included for db-mysql as there appears to be a few dependencies (e.g. setting up MYSQL_CONFIG environment variable).
What is the correct way to troubleshoot this error with Node.js on Windows with the SQL Server driver.
events.js:2549: Uncaught Error: 42000: [Microsoft][SQL Server Native Client 11.0
]Syntax error, permission violation, or other nonspecific error
It is not the SQL statement - it works in other tools - like .NET
Doesn't seem to be the SQL connection info - it works in other tools - like .NET
Any thoughts? What is the correct way for completely uninstalling node.js and starting over. I don't think my last install removed all my global modules.
var sql = require('node-sqlserver');
var _ = require('underscore')._;
var connstr = "Driver={SQL Server Native Client 11.0};Server=localhost;" +
"Initial Catalog=CDDB;Trusted_Connection={Yes}";
sql.open(connstr, function (err, conn) {
if (err) {
console.log("Error opening the connection");
return;
} else {
var stmt = "select top 10 * from Client";
conn.query(connstr, stmt, function (err, results) {
if (err) {
console.log("Error running query!");
return;
}
_.each(results, function (row) {
console.log(row[0]);
});
});
}
});
First idea : Are users which runs your node.exe process and the one defined on your application pool - or maybe your current user account if you are using VS.NET to check your code are the same ?
To troubleshoot :
I would use node-inspector - it allows to set up breakpoints onto your node.js code
To install it :
npm install -g node-inspector
To run it :
node --debug your-nodeapp-file.js
Launch another command line and run the following program :
node-inspector
Sorry but i do not have SQL Server to try your code, hope this help anyway.