问题
I'm trying to use Data-Atom package in the Atom Editor to connect to a SQL Server 2012 database. I can connect to the database with SQL Server Managment Studio using Windows Authentication or SQL Server Authentication. How the data-atom-connections.cson
file should be using these two authentication methods?
My data-atom-connections.cson
file looks like this:
[
{
name: "WindowsAuthentication"
protocol: "sqlserver"
user: "username"
password: "password"
server: "apphost/Username"
database: "master"
options: ""
}
{
name: "SQLServerAuthentication"
protocol: "sqlserver"
user: "userlogin"
password: "password"
server: "apphost/sqlexpress"
database: "master"
options: ""
}
]
But I get this error:
Error(ESOCKET) - Failed to connect to apphost:1433 - connect ECONNREFUSED 192.168.56.1:1433
Note: for specifying the server name I saw this post Logging In to SQL Server
回答1:
When this pull request is merged into data-atom you should have more luck.
- Enter
SERVER\INSTANCE
in the server field, orSERVER\\INSTANCE
if you're editingdata-atom-connections.cson
directly, to connect to a named instance. - Add the option
domain=YOUR_DOMAIN
to the options string to use Windows authentication (see more options for SQL Server here) - If you don't want to wait for the code to be merged into upstream and a new release, take it straight from my repo and place/link under
~/.atom/packages
. - The protocol part of the URL has changed to
mssql
for SQL Server to align withnode-mssql
.
来源:https://stackoverflow.com/questions/39197644/how-to-set-the-proper-connection-parameters-to-connect-a-sql-server-database-in