I am looking for a way to connect my Next.js application with Azure Database for PostgreSQL server. Prisma seems to work well with Next.js but I can't figure connection string or if it is even supported database.
Example: DATABASE_URL = 'postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public'
The host I am trying to connect to: posgreservertest.postgres.database.azure.com:5432
So it should be something like "[email protected]:5432/mydb?".
I am trying to npx prisma introspect and this is how my cmd looks like:
PS C:\Web stuff\nextjs\test> npx prisma introspect
Environment variables loaded from prisma\.env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "posgreservertest.postgres.database.azure.com:5432"
Introspecting based on datasource defined in prisma\schema.prisma …
Error: P1001
Can't reach database server at posgreservertest.postgres.database.azure.com:`5432`
Please make sure your database server is running at posgreservertest.postgres.database.azure.com:`5432`.
Is it even possible to connect to Connect to Azure Database for PostgreSQL server with Prisma as it doesn't feature this option in their supported databases?

Make sure you've set your database as publicly available.
Add a firewall rule to allow connections from your IP. If you aren't concerned much about security you can allow connections from any IP. Just set
0.0.0.0-255.255.255.255rule.Ensure that you are using the full username id. For Azure PostgreSQL server id consists of two parts
<username>@<servername>. In your following example full connection string will look like thisIf you've set SSL enforcing on your server make sure to add
sslmode=requireoption