Can't connect AdonisJS to SQL Server database - node.js

I use AdonisJS and SQL Server. I'm trying to connect my application to SQL Server, but it's not working. It works if I connect with SQL Server Management Studio:
But when I try to make a migration, I get an error. Here is my config/database.js: https://hasteb.in/odixoxom.kotlin
My .env :
DB_CONNECTION=mssql
DB_HOST=127.0.0.1
DB_PORT=1433
DB_USER=sa
DB_SERVER=DIDI-PC
DB_PASSWORD=123456
DB_DATABASE=WEB_PANEL
Does someone have a solution? Thanks!

I have the answer :)
it doesn't work like with mysql, there I have to create the db first and then access it, with mysql it was adonisjs who did it it it seems to me :)
And the "sa" username is just for testing haha, don't worries
Thanks !!

Related

Unable to connect ECONNREFUSED / Unable to connect ENOTFOUND mongo db vsCode

I'm trying to connect my mongodb to my vscode and when I try and connect to it using 'mongodb:// it comes up with a connection error. Can anyone help me with this please? 1
you need to try this flow to solve your issue. might be it helps you.
check mongo service is running or not.
if you mongo service is out side of your current machine than you check your IP has access to access your mongo service
check your mongo connection URL is correct.
try to connect your MongoDB using tools like MongoCompass or Robo 3t.
then try in your code for further task

connect hostinger DB with nodejs in local

I have created a database in Hostinger and make it remote. But, when I try to connect with my local using nodejs I am getting an error: "ER_ACCESS_DENIED_ERROR" even after using the right username and password.
This is my code below:
Have I done anything wrong? Please help me
This error usually occurs if the credentials are incorrect or the user can not access the database.
Also, In an express app, it is usually better to re-use the database connection instead of connecting to the database on every request.

Procedure for creating a database locally using mongodb

I've connected to mLab using MongoClient.connect, but now I want to create a local database rather than use mLab. I've tried changing the URL to "mongodb://localhost:27017/mydb" to create a database locally as suggested, but I'm getting a failed to connect to server error. Is there anything I should install? Or am I just missing something?
First, install your mongoDB server:
https://docs.mongodb.com/manual/installation/
After that, you should be able to start your local mongodb server:
sudo service mongod start //in case of linux
Here the docs to start the mongodb server
Then, you will type mongo and the client command line will start.
And when typing use yourDatabase, mongo will create the database if
it does not exist.
Then, your server will be up, and the database created. Anyway, check the docs if you need the guides for windows or other systems.
First you need to understand how server works and mlab works. mLab is a company who provide database as a services. Means you no need to handle server hurdles, they take care server , backups , infrastructure etc. They provide mongodb server , You just need to create database on mongodb server's and use them.
Now comes to main points.
If you want use mongodb on your local system then you first need to install mongodb on your local system and then connect it.

I want to connect openshift mongodb database from my local client tools

I have my premium openshift account
I have all types of access in openshift
I have ssh key & user's credentials
I have MongoVUE & Robomongo & others client tools to open mongodb database.
when I try to open any local mongodb database then its working fine
but I want to directly connect my mongodb database of openshift server to mongoVUE or any else
so I can see which data is in my server database.
I have tried so many times to connect locally but it can connect to openshift but can not connect with mongodb database so please provide some good & exact steps so I can connect it.
I use mongovue also. Just do a
'rhc port-forward '
Then run mongovue using the Mongodb credentials that OPENSHIFT gave you.
Steps.
rhc port-forward <app-name>
Wait a couple of seconds. You then should see something like this.
Then run Mongovue. Add a connection and enter in your Openshift Mongodb credentials like this:
Save, Select your connection, and press connect. It should work.
You should have been given you mongodb credentials when you added the mongodb cartridge. You can also ssh into your app and do a "env" and see your mongodb password and username.
Finally I got perfect tool for it to connect with mongodb with server database in which we can perform all kind of CRUD operations.
we can use Robomongo tool for it which doesn't require paid version to perform CRUD operation.
Robomongo is available here
http://robomongo.org/download.html
mongoVUE requires paid version.
I use Robomongo. Just do a 'rhc port-forward '
Then run Robomongo using the Mongodb credentials that OPENSHIFT gave you.
Steps.
rhc port-forward
Wait a couple of seconds. You then should see something like this.
port forward image
Then run Robomongo. Add a connection and enter in your Openshift Mongodb credentials:

Run mongodb from remote server

I am new to mongodb and want to know about connecting to remote server. I have mongodb running on remote server. I want to access the mongo database from another server and perform all the operation. How can i do that. I am using node.js with mongodb. Please help me how can i establish the connection.
You can use the following library for node:
https://github.com/christkv/node-mongodb-native
If you want a tool to access the database, you can use:
MongoHub (for Mac) & MongoVUE (for Windows)
Good luck!

Resources