Database drivers

Default built-in drivers

One of Prisma Client's components is the Query Engine . The Query Engine is responsible for transforming Prisma Client queries to SQL statements. The Query Engine connects to your database using the included drivers that don't require additional setup. The built-in drivers use TCP connections to connect to the database.

Query flow from the user application to the database with Prisma Client

Driver adapters

Prisma Client can connect and run queries against your database using JavaScript database drivers using driver adapters. Adapters act as translators between Prisma Client and the JavaScript database driver.

Prisma will use the Query Engine to transform the Prisma Client query to SQL and run the generated SQL queries via the JavaScript database driver.

Query flow from the user application to the database using Prisma Client and driver adapters

There are 2 different types of driver adapters:

Database driver adapters

You can connect to your database using a Node.js-based driver from Prisma Client using a database driver adapter. Prisma maintains the following database driver adapters:

Serverless driver adapters

Database providers, such as Neon and PlanetScale, allow you to connect to your database using other protocols besides TCP, such as HTTP and WebSockets. These database drivers are optimized for connecting to your database in serverless and edge environments.

Prisma maintains the following serverless driver adapters:

Community maintained database driver adapters

You can also build your own driver adapter for the database you're using. The following is a list of community maintained driver adapters:

How to use driver adapters

To use this feature:

  1. Update the previewFeatures block in your schema to include the the driverAdapters preview feature:

    generator client {
    provider = "prisma-client-js"
    previewFeatures = ["driverAdapters"]
    }
  2. Generate Prisma Client:

    npx prisma generate
  3. Refer to the following pages to learn more how to use the specific driver adapters with the specific database providers:

Edit this page on GitHub