I would like to switch from using a local db in my web app, to aws relation databases (RDS).
I have connected to the aws RDS via mysql workbench.
In order to make this switch, all I have changed is the connection string. But it doesn't work. (it hangs for 30 seconds then throws HTTP Error 502.3 - Bad Gateway).
the local db: =Server=localhost;database=ef3;uid=root;pwd=123456;
But when I change it to Server=test2.xxx.ap-southeast-2.rds.amazonaws.com;database=test2;uid=xx;pwd=xx;port=3306;, I get the following output from the console.
https://pastebin.com/raw/qA0py6t0
The last line says: "Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware","{OriginalFormat}":"An unhandled exception has occurred while executing the request"}}}
How do I fix the connection string, to connect to the AWS RDS?
Thanks guys
The connection seems fine, seems like that database doesn't contain the expected data.
From the trace:
MySql.Data.MySqlClient.MySqlException: Table 'test2.Events' doesn't exist
Related
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.
I am trying to connect a MySQL database via Google Cloud Data Fusion Wrangler. It's a very standard connection and I can connect and do every action with another tool (DBeaver). However, trying to connect with Wrangler, I am getting this message:
A server error occurred when testing the connection. Error: Exception occurred while handling request: string
Any suggestions? Thanks!
Please follow the instructions on https://cloud.google.com/data-fusion/docs/how-to/using-jdbc-drivers
Once done, you will be able to select the uploaded driver from the dropdown
For your requirement, you have to use JDBC Driver for connecting to MySQL database.You can use Public IP to setup connection to Wrangler.
Following are the steps to connect to MySQL database using Wrangler
Go to Hub in the Cloud Fusion instance and and select the required JDBC Driver.
Download the
driver and deploy it.
Go to Wranglers page and click on Add
Connection if you are connecting to MySQL for the first time.
Select
the MySQL database from the list of databases provided in Wrangler.
Add name and JDBC driver along with username, password and other connection arguments.
Click on test connection to check the connectivity.
For more details you can check this link.
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.
I'm tying to use the connection string provided by DigitalOcean directly on the appsettings.json file, but shows error
ArgumentException: Keyword not supported: postgresql://XXXXX_user:xxxxxxxxxxxxx#db-trackbus-nyc3-xxxx-do-user-xxxxx-0.b.db.ondigitalocean.com:xxxxx/trackbus?sslmode (Parameter 'keyword')
Npgsql.NpgsqlConnectionStringBuilder.GetProperty(string keyword)
This is the exact connection string provided by DigitalOcean:
postgresql://xxxx_user:xxxxx#db-trackbus-nyc3-xxxx-do-user-xxxxx-0.b.db.ondigitalocean.com:xxxxx/TrackBus?sslmode=require
I'm using Npgsql nuget package, when the db was local was working fine using th regular connection string
"Server=xxx.0.0.x;Port=xxxx;Database=TrackBus;User Id=postgres;Password=xxxx;"
I've also tried this (private and public):
"Server=private-db-trackbus-nyc3-xxxxx-do-user-xxxxx-0.b.db.ondigitalocean.com;Port=xxxxx;Database=TrackBus;User Id=xxxxx_user;Password=xxxxxxxxxx;Integrated Security=true;"
Error:
An unhandled exception occurred while processing the request.
PostgresException: 28000: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "xxxx", database "TrackBus", SSL off
I searched this last 28000 exception but couldn't apply any solution found.
The connection string provided by DigitalOcean is for CLI:
postgresql://xxxx_user:xxxxx#db-trackbus-nyc3-xxxx-do-user-xxxxx-0.b.db.ondigitalocean.com:xxxxx/TrackBus?sslmode=require
You have to convert it to the format that appsettings.json uses and it will be like this:
"Server=db-trackbus-nyc3-xxxx-do-user-xxxxx-0.b.db.ondigitalocean.com;Port=xxxxx;Database=TrackBus;User Id=xxxxxxxx;Password=xxxxxxxxx;sslmode=Require;Trust Server Certificate=true;"
The sslmode=Require;Trust Server Certificate=true; is super important because the managed database in DigitalOcean has it that that one.
Also remember that all postgresql database by default are blocking remote connection, you have to add the permission on the pg_hba.conf file from the Postgresql installation folder.
Question
What extra do I get if I fix this and get access to the admin database? (MyDataBaseName normal database works perfectly well)
Do I even need to fix this to use this postgres database for a Django 3.0 project?
Done -> ERROR
I have created a free tear AWS RDS Postgres 11 database.
I allowed external connections at creation and have successfully configured the inbound rules.
Than I have connected to pgAdmin (right click on server groups/create/server)
Than I got 3 database:
MyDataBaseName how I have named my database
postgesql that is auto generated
rdsadmin this is also auto generated,
I have problem with this one that it doesn't opens,
it has a rex x at the database icon
if i click on it it gives the following ERROR message
INTERNAL SERVER ERROR
FATAL: SomeConfigFileName.conf rejects connection for host "host.ip.adders.actully.with.numbers", user "myPersonalUsername", database "rdsadmin", SSL on
FATAL: SomeConfigFileName.conf rejects connection for host "host.ip.adders.actully.with.numbers", user "myPersonalUsername", database "rdsadmin", SSL off
"rdsadmin" is used for internal purposes by AWS. There should be no need to "fix" this.
The only things you are missing is things you aren't allowed to do anyway, and indeed not needing to deal with them yourself is what you are paying Amazon for.
Django shouldn't care. If it demands access to this database, that would be a bug in Django (or a configuration error)