Connecting to MongoDB from AWS Glue - mongodb

I am trying to create a connection from AWS Glue to MongoDB, but when I test the connection it fails with error: "Check that your connection definition references your Mongo database with correct URL syntax, username, and password. Exiting with error code 30". I know that my connection parameters are correct because I can connect with the same host, port, database, user name, and password from another client application (DataGrip). And I know that my VPC configuration should be correct too because I have another connection in the Glue, to connect to the PostgreSQL database on-premise with public IP, that works just fine.
My MongoDB version is 4.4.1. I am out of ideas what else can cause the problem. Is anyone successfully connects to MongoDB form Glue and run the Crawler?

Related

Prisma DB Can't connect to AWS RDS

I have a nextjs project that's using prismaDB for the ORM. I'm able to connect just fine to my local postgres db but I'm getting this error when running npx prisma migrate.
Error: P1001: Can't reach database server at db-name.*.us-west-2.rds.amazonaws.com:5432.
schema.prisma:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
//url = "postgresql://master_username:master_password#aws_host:5432/db_name"
}
The RDS db is currently public and I'm positive that I've copied over the RDS credentials correctly. There doesn't seem to be anything I should be including for the connection to work but I'm not getting any other info as to why I can't reach the db server.
Seems like you have to replace db-name.*.us-west-2.rds.amazonaws.com with the name of your actual database, unless you replaced it for the purpose of asking this question. Specifically the part where it says db-name.*.
Docs: https://www.prisma.io/docs/reference/api-reference/error-reference#common
P1001 indicates that it couldn't find the database given the connection string, NOT necessarily that the credentials you provided were wrong. Make sure you're specifying the correct database name/host and whatever else you need to make it work for AWS.
Somehow I was able to connect to RDS after deleting and creating a new DB for the third time. I confirmed connection through pgAdmin then tried it again my app deployed to vercel.

Has someone connected a PostgreSQL DB hosted in GCloud with Microsoft SSMS?

I have a question, I do not know how to solve it yet. Perhaps someone here has faced a similar issue.
We have a PostgreSQL DB hosted on Gcloud. We usually use a cloud proxy to connect with the database. It usually works very well!! In a nutshell the proxy connect a port from local host, to the actual DB host.
However this time, we want to connect it with Microsoft SSMS. We have not find an option where we can connect Microsoft SSMS with a DB running locally (this means connecting to a database on a port in local host).
The ultimate goal is to connect the database with Power BI. So if someone know how to connect a PostgreSQL DB hosted in GCloud to power BI that would also be very helpful!!
We have followed this tutorial:
https://www.anibalum.com.ar/2020/06/creating-linked-server-with-postgres.html
However we get the following error:
The linked server has been created but failed a connection test. Do you want to keep the linked server?
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "PAPERFLOWDB".
OLE DB provider "MSDASQL" for linked server "PAPERFLOWDB" returned message "[Microsoft][ODBC Driver Manager] Invalid connection string attribute".
OLE DB provider "MSDASQL" for linked server "PAPERFLOWDB" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". (Microsoft SQL Server, Error: 7303)
We are using Microsoft SSMS v18.9.1

What could I be missing with Prisma client, Cloud Run, and Cloud SQL - my Prisma client can't socket-connect to my Cloud SQL instance DB?

Background
I have a NestJS project with Prisma ORM, and I am continually receiving the error:
PrismaClientInitializationError: Can't reach database server at `localhost`:`5432`
This is happening during the Cloud Build Deploy step.
Since this is a containerized application (attempting to) run in a Cloud Run instance, I'm supposed to use a socket connection. Here's the documentation from Prisma on connecting to a Postgres DB through a socket connection: https://www.prisma.io/docs/concepts/database-connectors/postgresql#connecting-via-sockets
Connecting via sockets
To connect to your PostgreSQL database via sockets, you must add a host field as a query parameter to the connection URL (instead of setting it as the host part of the URI). The value of this parameter then must point to the directory that contains the socket, e.g.: postgresql://USER:PASSWORD#localhost/database?host=/var/run/postgresql/
Note that localhost is required, the value itself is ignored and can be anything.
I've done this to the letter, as described in the Cloud SQL documentation, with the exception that I percent-encoded my path to the directory containing the socket. I've included and excluded the trailing slash.
So my host var looks like this, mapped from the percent-encoded values:
/cloudsql/<MY CLOUD SQL CONNECTION NAME>/<DB>
I've read over the Cloud Run documentation, and in my mind, I should expect a different error if the instance itself can't connect to the Cloud SQL instance. I've followed the "Make sure you have the appropriate permissions and connection" from the documentation a few times now.
Is there anything obvious that I'm missing? Am I wrong about an error related to Cloud Run instance just not connecting with Cloud SQL instance?
Things I've tried & things I know
I CAN connect directly to the Cloud SQL instance locally through psql
I CAN run a local server with the Cloud SQL instance public IP and establish a client connection & interact with the database
I CAN successfully create an image and run a container from that image locally
My big concern
It doesn't make sense to me in which order things should connect to the Cloud SQL instance. To me, the Cloud Run - Cloud SQL connection MUST be established before the application run inside the Cloud Run instance can establish its connection through the socket to the Cloud SQL instance. -- Am I thinking through that correctly?

Postgres OLBC Connection error: FATAL: No pg_hba_conf entry

I am trying to create a linked server between the warehouse and a amazon cloud service.
The service provide is using a PostgreSQL database.
I have installed the ODBC Driver (12.10) on my server but I keep getting this error.
I am not sure how to work around this as I have never used Postgres before.

java.net.UnknownHostException: when trying to connect to heroku postgres through intellij

I have just signed up to a free heroku account hoping to try and see if a web app I am making functions properly, all works fine on my local machine connected locally to my postgres db.
I am trying to connect to the heroku postgres db I set up. I have connected fine through pgadmin and also in the application.yaml file so that when in prod profile, it runs on the heroku postgres database.
But if I try and connect to the DB using the intellij database connection, I keep getting an error,
[08001] The connection attempt failed. java.net.UnknownHostException: ec2-54-73-110-26.eu-west-1.compute.amazonaws.com
I have checked everything several times, and all the fields on the database connection wizard are correct. I have also set ssl to true, sslmode to verify-ca and sslfactory to sslfactory:org.postgresql.ssl.NonValidatingFactory
but I get the above error each time.