Back to Prisma1

Database Connector POSTGRES Jgfr

docs/1.33/prisma-server/database-connector-POSTGRES-jgfr.mdx

1.34.121.8 KB
Original Source

import Code from 'components/Markdown/Code' import Warning from 'components/Markdown/Warning'

export const meta = { title: "Database Connector (PostgreSQL)", position: 51, technology: "postgres", technologyOrder: 2, articleGroup: "Database Connector" }

Overview

A database connector is the bridge between Prisma and the underlying database. The PostgreSQL connector is used to connect a Prisma server to a PostgreSQL database.

The core responsibilities of a database connector are:

  • Translate Prisma client requests into SQL
  • Send the generated SQL query to the database
  • Return the database results as back to the Prisma client
  • Perform database migrations (optional)

When configuring your Prisma server with Docker, you need to specify which connector you'd like to use in order to connect to a certain database. You provide this info via the connector property:

<Code lines="6">
yml
PRISMA_CONFIG: |
  managementApiSecret: __YOUR_MANAGEMENT_API_SECRET__
  port: 4466
  databases:
    default:
      connector: postgres
      host: __YOUR_DATABASE_HOST__
      port: __YOUR_DATABASE_PORT__
      user: __YOUR_DATABASE_USER__
      password: __YOUR_DATABASE_PASSWORD__
      connectionLimit: __YOUR_CONNECTION_LIMIT__
</Code>

Managing database connections

The connectionLimit property in PRISMA_CONFIG determines the number of database connections a Prisma service is going to use.

<Warning>

The connectionLimit needs to be set to at least 2. One connection is always reserved for the Management API, all other connections are used for the Prisma service.

</Warning>

Database schema

Prisma currently maintains a table called _RelayId. This table is there for historic reasons and will be removed soon.