Plotly and SQL Server Express compatibility - sql-server

I'd like to know if the Plotly Database Connector (when doing a SQL Server connection) supports a SQL Server Express edition database.
I tried to connect using the sa username and its password but nothing happened. I get the error:
Failed to connect to [hostname]:[PortNumber] - connect ECONNREFUSED [my IP address]:[PortNumber]
These are my inputs:
Username: sa
Password: mypassword
Host: myHost (SQL Server Express as my instance)
Port: (I left this port blank)
Database: myDB
So, it is compatible? Or does it only work with (full) SQL Server?

Well I achieved to connect SQL SERVER Express with the Plotly Database Connector, so I hope this answer helps someone in the future!
First of all I asked in its GitHub page and the developer answered with a reference of the same problem and its solution.
Basically you have to search and modify the file named: connection-manager.js
Which was located in this directory: C:\Users\Arturo\AppData\Local\Programs\plotly-database-connector\resources\app\node_modules\sequelize\lib\dialects\mssql\connection-manager.js after I installed the Connector in my PC (your path may vary).
Then, you open it, and, in the line 42 you'll see this code (if it isn't in that line just look up for the code) :
var connectionConfig = {
userName: config.username,
password: config.password,
server: config.host,
options: {
port: config.port,
database: config.database
}
The problem here is that you have to give it the instance name, so, we will add one line more of code:
var connectionConfig = {
userName: config.username,
password: config.password,
server: config.host,
options: {
port: config.port,
database: config.database,
instanceName: 'SQLEXPRESS'//this line.
}
And that's it! We save the file and restart our Plotly Database Connector, after doing it we introduce our credentials as usual (without the \sqlexpress in the host field) and it will work!
Note: If you have a text editor like SublimeText, it's easier to find the code that I'm showing, just press Ctrl+Shift+F and search by folder, inserting the full path of the Plotly Database Connector.

Related

Pimcore Database Installation on a Different Server

I have just started using Pimcore and deployed its a mysql database on another server. During its installation, it couldn't connect to the database. I created the database yml file using this link https://pimcore.com/docs/5.x/Development_Documentation/Getting_Started/Advanced_Installation_Topics.html for the configuration and still does not work. It only works when the database is on the same server as pimcore. The error it gave when I do a remote connection is this:An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'SSL_USER'#'x.x.x.x' (using password: YES).
The yml file I created looks like this:
parameters:
database_credentials:
user: SSL_USER
password: password
dbname: project_database
# env variables can be directly read with the %env() syntax
# see https://symfony.com/blog/new-in-symfony-3-2-runtime-environment-variables
host: x.x.x.x (Ip address of db server)
port: 3306
Please take a look, you are using 'SSL' reserved word in your username.
Just use another username.
Please see the list of reserved words here: https://dev.mysql.com/doc/refman/8.0/en/keywords.html

express project not connecting to database (express)

At work I have been creating a full stack website using express and react with a sql server database.
I have now been self isolated due to the corona virus (everything at work was working fine).
I have restored the database and the code.
I have enabled tc/ip and pipelines in sql server configuration manager.
I have the made sure the password for the sa account is correct.
this is what i receive
] Err: ConnectionError: Connection is closed.
What else is there to check to make sure this is working?
Any help in what I may have overlooked would be great
edit ----
using npm mssql here is config
var config = {
user: "sa",
password: "Mypassword123",
server: "localhost", // You can use 'localhost\\instance' to connect to named instance
database: "CDA"
//enableArithAbort: false
};
I solved this by creating a default instance of sql and using this instead of the named instance I was trying to use.

data-atom cson configuration for Windows authentication remote

I can't connect to an mssql server using Windows Authentication on data-atom. I've successfully connected to servers using SQL server authentication, so I know data-atom is working. However, I can't figure out the proper parameters for windows authentication.
I normally log in using runas.exe /netonly /user:REALDOMAIN\YOURDOMAINUSERNAME Ssms.exe and then do windows authentication from there.
I've launched atom both using the netonly runas commands and normally. However, I am not able to find the proper parameters to connect to the server.
I've tried doing
{
name: WindowsAuth
protocol: "mssql"
user: = Username
password: ""
server: <ServerName>
database: "Master"
options: "domain=remoteDomain"
}
and
{
name: WindowsAuth
protocol: "mssql"
user: = remoteDomain\Username
password: ""
server: <ServerName>
database: "Master"
options: "domain=remoteDomain"
}
The first thing to know is that many data-atom connection questions can be resolved by looking at the documentation for tedious.js
In this specific case, even though you are using windows authentication, you need to give your username and password. Furthermore, the domain information is case sensitive, and needs to be stripped of anything like .local or .com.
Finally, you should not include any options related to trustedConnection. The domain option is sufficient.
My final configuration looks like
{
name: WindowsAuth
protocol: "mssql"
user: = remote_domain_username
password: password
server: server_name
database: root_db
options: "domain=remote_domain_match_case"
}
Though, it is best practice not to store your password in your config file. Instead, type it in whenever you open a new connection.

Nodejs connection with mssql showing error

I am trying to connect with my sql server using nodejs, with the following code.
const sql = require('mssql');
var config = {
user: 'user',
password: 'psw',
server: 'localhost',
database: 'sumit'
};
var mssql = new sql.ConnectionPool(config);
mssql.connect().then(function(){
var req = new sqlDb.Request(conn);
req.query("SELECT * from Category").then(function(res){
console.table(res);
});
}).catch(function(err){
console.log(err);
})
but everytime it is showing
ConnectionError: Failed to connect to localhost:1433 - Could not
connect (sequence)
how should i connect with my sql server?
i have tried to change config also
var config = {
user: 'user',
password: 'psw',
server: 'DESKTOP-VVN4PRG\\SQLEXPRESS',
database: 'sumit'
};
but still getting same error.
I resolved my problem. I am putting my answer here, So maybe it will help someone.
Step 1: Check if you have selected SQL Server and Windows Authentication mode on Server Authentication section
Path: SMSS>Go to object explorer properties> Security(Check SQL
Server and Windows Authentication mode, if not, then check it)
Step 2: Check if you have TCP Port 1433 and TCP Dynamic Port is Blank(not 0)
Path: SQL Server Configuration Manager>SQL Server Network Configuration>Protocols for SQLEXPRESS> Double click on TCP/IP>IP
Addressess> Check for IPALL and for 127.0.0.1
Step 3: If you have performed any of the above or both the operation then please restart all your SQL Services by going
Path: Window + R> type services.msc and hit enter> Check for your SQL Services and restart all
Hope this would help someone.
I struggled for more than 2 hours and finally landed on this solution to enable SQLBrowser and it worked like magic
In my case I had to do both things mentioned on the 2 answers above. I had to fix the IPALL on step 2 for answer 1.
And turn on the Sql Server Browser service too. Without this service the mssql would not connect.
This makes sense to me after read what this service does. Found this Microsoft article How SQL Server Browser works

How to set the proper connection parameters to connect a SQL Server database in Atom Editor using Data-Atom package?

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
When this pull request is merged into data-atom you should have more luck.
Enter SERVER\INSTANCE in the server field, or SERVER\\INSTANCE if you're editing data-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 with node-mssql.

Resources