Failed to connect to SQLEXPRESS - Node.js - javascript

I am trying to connect to my MS SQL database via node.js (Express), but the connection cannot be established. I have probably wrong configuration, but I have tried everything and nothing worked. I also enabled TCP/IP in configuration Manager.
Here is my JS code: https://snipboard.io/ufk49d.jpg
Here is one of my errors: https://snipboard.io/wyTbLi.jpg
When I add localhost or IP adress before SQLEXPRESS in server configuration, it thow this error: https://snipboard.io/RE6Xov.jpg
And also, I added new user and allow SQL auth and windows auth connection.
Thanks for your tips!

Can you put your machine name in server parameter?
server: 'YOUR_MACHINE_NAME\\SQLEXPRESS',

Related

Why mongodb on production is using local computer connection?

I am developing a react-admin site and using mongodb. When I uploaded files to the server, it seems that production version on server is using my local computer mongodb connection. This is my connection string: mongodb://localhost:27017/my-collection
If I try to access a site from my computer, it works, because it uses local computer connection, if I try to access it from phone , it does not works, only shows Could not connect to the server
Site is served by nginx and run with pm2
Can somebody help? What I am doing wrong?
I had to change url in react-admin dataProvider. it had localhost:3001, but I had to changed it to myDomain.com:3001

Config Action Cable for Heroku - Error localhost:3000/cable

I have problem with my app with Action Cable on Heroku:
WebSocket connection to 'ws://localhost:3000/cable' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
My production.rb:
config.action_cable.url = "wss://NAME.herokuapp.com/cable"
config.action_cable.allowed_request_origins = ['https://NAME.herokuapp.com', 'http://NAME.herokuapp.com']
I tried to specify the server in the cable.js as well:
#App ||= {}
App.cable = ActionCable.createConsumer("wss://NAME.herokuapp.com/cable")
I tried to change it in development.rb just in case but nothing helps. The Heroku is still trying to connect to localhost.
Another weird thing that has nothing in common with it I think, is that the app is not able to process some js code like: alert('test') or console.log("haha") despite of some js code works and I tried assets:precompile as well.
In localhost, everything works perfectly. Any idea what can be wrong with heroku and the setting?
While ActionCable was in development, I remember you had to startup 2 servers for the cable connection and for Rails. I don't think that is still needed for the final release.
My guess is that you don't have Redis provisioned on your Heroku instance, whereas in Production, ActionCable relies on Redis for it's server communication.
To fix this, you should do the following:
heroku addons:add redistogo
heroku config | grep REDISTOGO_URL
In your config/cable.yml, set the Redis url to the one given. I guess you should also be able to use ENV['REDISTOGO_URL'] in place of the url.
Let me know if that helps.
If it's working locally but not remotely it may be an SSL problem. Make sure you properly set up an SSL endpoint for the secure websocket (wss):
https://devcenter.heroku.com/articles/ssl-endpoint
Also, there is an excellent blog post on Heroku about how to set up Action Cable: https://blog.heroku.com/real_time_rails_implementing_websockets_in_rails_5_with_action_cable. Alas, the article does not mention the necessity of setting up an SSL endpoint for the Heroku deployment to work.

Connect deepstream server to rethinkdb instance

I have tried to set up a deepstream.io instance but ran into some difficulties:
I don't know how to connect the deepstream.io instance to the rethinkdb server. I tried this condiguration:
//rethinkdb connector
server.set( 'storage', new RethinkDbConnector({
port: 28015,
host: '104.155.51.222',
splitChar: '/',
defaultTable: 'users'
}));
However, the server crashes after the start and puts out:
PLUGIN_ERROR | storage wasn't initialised in time
although I opend all the ports needet (8080 and 28015) and kept the instace running via tmux.
Do you have any idea how to fix this? I would really appreciate an answer, thanks in advance!
Stefan
Hm - looks like a connectivity issue between the machine that deepstream.io is running on and your RethinkDB machine. Just tried accessing 104.155.51.222:8080 in a browser and it timed out. Could you try
a) if you can access the admin gui
b) if you can ping 104.155.51.222 from your deepstream machine
Thanks for your answer! I was yersterday able to solve it by adding rethinkdb --bind all to the start command and using the eth0 adress to connect to it from the deepstream server.
However, there is now one more pressing issue I ran into: I am trying to connect the client-side sample code provided in the tutorial to a remote server who is already wired up for production. But once I connect to the server the chrome dev tools show something like this.
The deepstream server is running with the following configurations:
server.set( 'host', '0.0.0.0' );
server.set( 'port', 6020 );
Do you have an idea what went wrong? Anyways,thank you for your awesome work at deepstream.io, I really appreciate it!

Fail to connect Mongolab with MongodbShell

I'm trying to connect the Mongo shell with Mongolab. I am using my mongolab username and password but it is giving an error: "Failed to connect to 54.81.180.188:56789."
My userName and password is correct.
I'm using Windows 8.1
When I ping ds0-----.mongolab.com that's working fine.
C:\mongodb\bin>mongo ds0----.mongolab.com:56789/dbname -u "MyUserName" -p "MyPassword"
MongoDB shell version: 3.0.3
connecting to: ds027751.mongolab.com:56789/dbname
2015-06-05T10:55:30.019+0530 W NETWORK Failed to connect to 54.81.180.188:56789, reason: errno:10061 No connection could be made because the target machine actively refused it.
2015-06-05T10:55:30.024+0530 E QUERY Error: couldn't connect to server ds027751.mongolab.com:56789 (54.81.180.188), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
I had the same problem, my server abruptly lost the ability to connect to MongoLab. I contacted support, who sent this reply:
Hello,
Your Experimental Sandbox plan is running MongoDB 3.0.x, which
includes changes to Mongo's authentication mechanism. This new
mechanism is supported by certain newer driver versions, as described
at
http://docs.mongodb.org/manual/release-notes/3.0-scram/#upgrade-drivers.
To connect to this database, you will need to use one of the drivers
listed at the above link.
Please let us know if you have questions about this.
Sincerely, Samson
I assume I was upgraded automatically, as I hadn't touched the server code or MongoLab in months. As an immediate fix, I just created a new db in MongoLab, which was created in mongod v2.6.9 (I don't remember seeing an option to choose the version).

Node.js on Azure Worker Role w/ SSL results in ERR_SSL_PROTOCOL_ERROR

I have a WorkerRole configured to start node.exe via the Runtime/EntryPoint/ProgramEntryPoint element in the csdef and have a HttpsIn EndPoint configured for https on port 443 w/ a valid certificate. I'm also setting the PORT environment variable in Runtime/Environment which is used by node to listen on for incoming requests.
When I start the service (either in local dev fabric or in Azure) and try to hit the service I get the following error:
SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
I have verified that node.exe is indeed started when the service starts, and if I look up the local port in the Compute Emulator, usually something like:
http://localhost:444
I am able to successfully hit node directly with that using my browser. I am also able to hit node through Azure when SSL is not configured.
What am I missing? Thanks!
The issue was that I was using the http module instead of the https module when starting the web server in Node. Works once I started the https server using the ssl certificate.
I was following a guide for SSL w/ Node in a WebRole, which requires a different set up than SSL w/ Node in WorkerRole.

Categories