Can't we use oracle12c instead of mysql in node.js - node.js

I have used Oracle 12c instead of mysql.
but I am getting "Error: connect ECONNREFUSED 127.0.0.1:3306"
how to resolve this bug?

Have a look at node-oracledb. Here's a quick start video you can check out too.

Oracle’s network protocol is quite different from MySQL’s, and you can’t use a MySQL client library to connect to an Oracle database. The error message you quote looks like it’s from a MySQL client, since it’s trying port 3306, which is the default port for MySQL. There are Oracle clients for node.js, but I’ve never used any of them and don’t know how good they are.

Related

MongoDb in Fastcomet shared hosting server

I haven't created an account in fastcomet yet, but I would like to ask the following questions. The site mentions that it supports node.js applications. So that means I can upload an express application right? How about MongoDB and mongoose? I can access MongoDB by typing in the terminal
$ mongod --dbpath=data -bind_ip 127.0.0.1
And the MongoDB URL in my case is
mongodb://localhost:27017/ilovearisti
How different would it be in fastcommet? I guess I'll have to contact them for the port numbers right?
Thanks,
Theo.
FastComet Team here! Indeed, our hosting plans are fully compatible with Node.js apps and you can have your project hosted on an appropriate package.
If you plan using the MongoDB database type in particular, our experience shows it requires a server solution with more resources and a higher level of private access. This way you would be able to accommodate the operation on an environment suitable for coding with Mongoose on top of the MongoDB driver for Node.js.
As for addressing your URL query, the default IP when starting a mongo instance is set to 127.0.0.1, so it is configured as localhost and port 27017. With this in mind, you only need to make changes on the IP configuration via the mongod daemon if you are using a remote database setup with a different IP address.
Having said all of the above, we can confirm that if you have created a database called iloveiristi, the MongoDB URL will be as follows:
mongodb://localhost:27017/iloveiristi
We hope this information proves useful and we wish you good luck with your project.
Best regards!

Router cannot connect to MongoDB cluster

I am working on a MERN project. I was previously able to connect to the MongoDB cluster via the connection string in my node application. A few days ago I changed my wifi router and I am not able to connect to the database anymore.
I am sure the problem is the router because when I connect through my phone's internet, the connection is successful. Unfortunately, I cannot use my phone's internet always as it is really expensive.
I have tried to factory reset my router as suggested in this question.
Error at connecting to MongoDb Atlas Server
I have also tried to enable port forwarding for port 27017, 27018, 27019 (default ports of MongoDB) through the router settings as suggested by someone on the internet.
Screenshot of my router settings
But did not face any success.
Some additional information. I am using a d-link router(DIR-819). The latest version of windows, node.js at the time of asking this question. Any help would be greatly appreciated as I am stuck on this problem for hours now.
EDIT: Here is the output when I try connecting through the shell.
DNSHostNotFound: Failed to lookup service ": This operation returned because the timeout period expired.
try 'mongo --help' for more information.
Please help me out, guys.
I have whitelisted all the IP addresses.
Cheers Everyone
Okay, look I'm also facing the same issue.
The reason behind this is because your Router is not letting your backend to make a connection with the MongoDB atlas.
You can still use it through your mobile network. Connect your PC with your mobile network and then try again it will work. (worked for me)
And for the Router issue, I'm still searching the solution once I find it, I'll be updating the answer. And yes if you find the solution before me be sure to Update us.
Use MongoDB in local machine. If that helps. I was also facing a similar issue so dropped the idea of connecting it to MongoDB Atlas. I downloaded it and it's running smoothly
Try to downgrade nodejs driver. I have resolved this by downgrading nodejs 3.2 driver string to 2.2 driver string.

Alternatives for connecting MongoDB Atlas to Heroku Node.js app

I've been working on a simple website using node.js, express, and MongoDB, with Heroku as the platform. I had a lot of issues early on trying to connect to my MongoDB Atlas cluster, resulting in Heroku throwing request timeout errors.
After some googling, I surmised that the issue was that the IP addresses Heroku sends requests to my DB from weren't whitelisted in Atlas. The simplest solution at that point was to egregiously set up so that any IP is considered whitelisted. Which actually works fine currently.
My actual question comes down to the fact that whitelisting all IPs hardly seems like a professional way to go about doing things.
What is a better solution?
You should only allow those IPs from which your application will connect to MongoDB Atlas. Allow all IPs is a bad practice and could make that MongoDB instance vulnerable.

Connecting to a mongoDB with a TCP prefix on a NodeJS application

I created a NodeJS app that connects with a MongoDB and it seems to work locally.
Now, after hosting the NodeJS application on a remote machine, I am trying to connect to a mongoDB that was already created on that machine. When I print out some of the environment variables, the only one I see of relevance seems to be :
MONGODB_PORT: 'tcp://172.30.204.90:27017',
I tried connecting like I usually do with
mongoose.connect('mongodb://localhost:27017/metadata/')
and replacing it with mongoose.connect('tcp://172.30.204.90:27017/metadata') but I get an error that says my URI needs to start with 'mongodb'.
So I tried replacing it with mongoose.connect('mongodb://172.30.204.90:27017/metadata') and it no longer throws any error. But on the MongoDB side I don't see any new connections happening and my app does not start up on the machine. What should I be putting in the URI?
Your URI should indeed start with mongodb:
mongoose.connect('mongodb://username:password#host:port/database?options...');
See this page for more information: https://docs.mongodb.com/manual/reference/connection-string/
Did you try to connect to the database from cli? Or Telnet to see that connection isn't blocked.

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