Reputation: 753
I am trying to connect sails 1.0 to SQL Server, but I've been out of luck so far. There doesn't seem to be anything publicly available.
I did found someone on GitHub that did try to add support, although when i try to use their branch it didn't work out too well.
Got this error when I try to use the model.findOne()
method.
name: 'RequestError',
message: 'Incorrect syntax near \'BY\'.',
code: 'EREQUEST',
number: 102,
lineNumber: 1,
state: 1,
class: 15,
serverName: 'sql1b',
procName: '',
precedingErrors: [] }
Was anyone else more lucky in getting sails 1.0 to work with a SQL Server database?
Upvotes: 0
Views: 613
Reputation: 9
Yes, you can try sails-sqlserver-sailsv1. But don't follow the guide in the npm site, probably a copy/paste error on how to install the package. use:
npm install sails-sqlserver-sailsv1 --save
And in the datastore configuration on sails make sure to use the correct adapter name:
default: {
adapter: 'sails-sqlserver-sailsv1',
user: 'cnect',
password: 'pass',
host: 'abc123.database.windows.net' // azure database
database: 'mydb',
options: {
encrypt: true // use this for Azure databases
}
}
I hope it helps you.
Upvotes: 1