Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close connection #11

Open
massilvaLaz opened this issue Apr 14, 2016 · 1 comment
Open

Close connection #11

massilvaLaz opened this issue Apr 14, 2016 · 1 comment

Comments

@massilvaLaz
Copy link

When i try to close connection I have an error

"TypeError: Cannot read property 'close' of null"

var Database = require('jt400');
var database = new Database();

var config = {
  libpath: __dirname + '/jt400.jar',
  drivername: 'com.ibm.as400.access.AS400JDBCDriver',
  url: 'jdbc:as400://127.0.0.1/myDatabase;user=myUser;password=myPassword'
};

database.initialize(config);
database.open();
database.execute("select * from mtfusrp "); 
database.on('execute', function(error, results) {
    if (error) {
       console.log(error);
   }
   else {
     console.log(result);
  }
});
database.close();

What is the right way to open and close a connection !

@paulomcnally
Copy link
Owner

Try call close method after callback is finished

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants