Comments (2)
from nodem.
Yes, there are a couple ways to handle this. First, if the database connection hasn't been opened, then the Nodem APIs will return with an exception, which you could catch in a try/catch statement, and then open the connection to the database before using the APIs, e.g.
> const nodem = require('nodem').Ydb();
undefined
> nodem.get('^global');
Uncaught Error: YottaDB connection is not open
> try {
... nodem.get('^global');
... } catch (err) {
... nodem.open();
... nodem.get('^global');
... }
1000
Second, the version API only reports the version of the underlying YottaDB or GT.M system, when the database connection has been opened, so you could search for the substring 'YottaDB Version' (or 'GT.M Version' when using GT.M), in the output of the version API, to determine if there is a current database connection, e.g.
> const nodem = require('nodem').Ydb();
undefined
> nodem.version();
'Node.js Adaptor for YottaDB: Version: 0.20.0 (ABI=93) [FWS]'
> nodem.version().includes('YottaDB Version');
false
> nodem.open();
{ ok: true, pid: 86593, tid: 86593 }
> nodem.version();
'Node.js Adaptor for YottaDB: Version: 0.20.0 (ABI=93) [FWS]; YottaDB Version: 1.32'
> nodem.version().includes('YottaDB Version');
true
I hope that helps! I'm going to close this issue, as I believe I have addressed it sufficiently. Thank you.
from nodem.
Related Issues (15)
- Always getting error GTM-E-SYSCALL HOT 3
- Are lock and unlock needed for transaction commit? HOT 2
- GT.M bindings/drivers for AIX System HOT 2
- Create a HOT 1
- Error on opening database HOT 2
- Why YottaDB connection can't be opened by worker thread? HOT 1
- Link to Globals Node.js API Documentation is broken (in README.md) HOT 1
- Error: Module version mismatch. Expected 11, got 1. HOT 1
- error when trying to install with npm on Ubuntu 12.04 LTS 64bit server HOT 1
- SyntaxError: Unexpected token when using function with parameters HOT 5
- enconding problem HOT 2
- Easy install now that apt-get install fis-gtm exists? HOT 3
- function - error when passing argument with quotes HOT 4
- GT.M can not be re-opened HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodem.