Guest User

Untitled

a guest
Aug 17th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. //Import OrientJS driver for OrientDB
  2. var OrientJs = require('orientjs');
  3.  
  4. //Connect to OrientDB server
  5. var server = OrientJs({
  6. host: "localhost",
  7. port: "2480",
  8. username: "root",
  9. password: "root"
  10. });
  11.  
  12. //Connect to 'demodb'
  13. var db = server.use({
  14. name: 'demodb',
  15. username: 'root',
  16. password: 'root'
  17. });
  18.  
  19. console.log("Connected to database")
  20.  
  21. //Select all entries in 'Castles' table and print to console
  22. db.select().from('Castles').all()
  23. .then(function(result) {
  24. console.log(result);
  25. });
  26.  
  27. //Close connection to database
  28. db.close();
  29.  
  30. Unhandled rejection OrientDB.ConnectionError [0]: Socket Closed
  31. at Connection.<anonymous> (C:Program Filesnodejsapollo_servernode_modulesorientjslibtransportbinaryconnection.js:277:16)
  32. at Object.onceWrapper (events.js:313:30)
  33. at emitNone (events.js:106:13)
  34. at Socket.emit (events.js:208:7)
  35. at endReadableNT (_stream_readable.js:1064:12)
  36. at _combinedTickCallback (internal/process/next_tick.js:138:11)
  37. at process._tickCallback (internal/process/next_tick.js:180:9)
Add Comment
Please, Sign In to add comment