I have MongoDB used in my application, now I need to connect to Postgresql to get some other data. But after I add connection and model for Postgresql, there's an error occurred when I started the application with sails lift
. Following are the whole error message:
error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
error: syntax error at or near "SELEC"
at Connection.parseE (/Users/xx/Documents/xx/Code/services/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/Users/xx/Documents/xx/Code/services/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/Users/xx/Documents/xx/Code/services/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:535:20)
All the changes I made comparing the working application are:
- Added
connection: 'mongodb'
inmodels.js
to set MongoDB as the default DB connection. - Add
connection: 'postgresdb'
in my new created model (ActivityController) for connecting to Postgresql.
It took me a lot of time working on this. As my investigation and learning on the documentation, seems all configuration things are okay. Did I miss anything?
I'd be appreciated if anyone can help.