Database drivers
Default built-in drivers
One of Prisma Client's components is the Query Engine (which is implemented in Rust). The Query Engine is responsible for transforming Prisma Client queries into SQL statements. It connects to your database via TCP using built-in drivers that don't require additional setup.
As of Prisma ORM 7, the query compiler (client engine) is the default, which means Prisma Client is generated without a Rust-based query engine binary. This provides better performance and developer experience. Learn more here.
In Prisma ORM 7, the default generator configuration is:
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
Note that driver adapters are required when using the query compiler.
You can read about the performance and DX improvements of this change on our blog.

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 Client will use the Query Engine to transform the Prisma Client query to SQL and run the generated SQL queries via the JavaScript database driver.

There are two different types of driver adapters:
Note: Driver adapters enable edge deployments of applications that use Prisma ORM.
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 adapters for the following drivers:
- PostgreSQL
- Prisma Postgres
- MySQL/MariaDB
- SQLite
better-sqlite3libSQL(Turso)
- MS SQL Server
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 ORM maintains the following serverless driver adapters:
- Prisma Postgres
- Neon (and Vercel Postgres)
- PlanetScale
- Cloudflare D1
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
Refer to the following pages to learn more about how to use the specific driver adapters with the specific database providers:
Notes about using driver adapters
New driver adapters API in v6.6.0
In v6.6.0, we introduced a simplified version for instantiating Prisma Client when using driver adapters. You now don't need to create an instance of the driver/client to pass to a driver adapter, instead you can just create the driver adapter directly (and pass the driver's options to it if needed).
Here is an example using the @prisma/adapter-libsql adapter:
Before 6.6.0
Earlier versions of Prisma ORM required you to first instantiate the driver itself, and then use that instance to create the Prisma driver adapter. Here is an example using the @libsql/client driver for LibSQL:
import { createClient } from '@libsql/client'
import { PrismaLibSQL } from '@prisma/adapter-libsql'
import { PrismaClient } from '../prisma/generated/client'
// Old way of using driver adapters (before 6.6.0)
const driver = createClient({
url: env.LIBSQL_DATABASE_URL,
authToken: env.LIBSQL_DATABASE_TOKEN,
})
const adapter = new PrismaLibSQL(driver)
const prisma = new PrismaClient({ adapter })
6.6.0 and later
As of the 6.6.0 release, you instantiate the driver adapter directly with the options of your preferred JS-native driver.:
import { PrismaLibSQL } from '@prisma/adapter-libsql'
import { PrismaClient } from '../generated/prisma/client'
const adapter = new PrismaLibSQL({
url: env.LIBSQL_DATABASE_URL,
authToken: env.LIBSQL_DATABASE_TOKEN,
})
const prisma = new PrismaClient({ adapter })
Driver adapters and database connection configuration
In Prisma ORM 7, the database connection URL is configured in prisma.config.ts. However, when using a driver adapter, the connection string needs to be provided in your application code when the driver adapter is set up initially.
Here is how this is done for the pg driver and the @prisma/adapter-pg adapter:
import 'dotenv/config'
import { PrismaClient } from '../generated/prisma/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
See the docs for the driver adapter you're using for concrete setup instructions.
See the connection pool guide for the Prisma ORM v7 driver adapter defaults and how they map from Prisma ORM v6 URL parameters.
Prisma ORM also has its own configurable timeouts that are separate from the database driver timeouts. If you see a timeout error and are unsure whether it comes from the driver or from Prisma Client, see the Prisma Client timeouts and transaction options documentation.
Driver adapters and custom output paths
In Prisma ORM 7, the recommended approach is to use a custom output path for Prisma Client. The default output path is ../generated/prisma.
Let's assume you have output in your Prisma schema set to ../generated/prisma:
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
You can reference Prisma Client using a relative path from your application code:
import { PrismaClient } from './generated/prisma/client'
const client = new PrismaClient()
Alternatively, you can use a linked dependency for cleaner imports.
- npm
- pnpm
- yarn
npm add db@./generated/prisma
pnpm add db@link:./generated/prisma
yarn add db@link:./generated/prisma
Now, you should be able to reference your generated client using db!
import { PrismaClient } from 'db'
const client = new PrismaClient()
Driver adapters and specific frameworks
Nuxt
Using a driver adapter with Nuxt to deploy to an edge function environment does not work out of the box, but adding the nitro.experimental.wasm configuration option fixes that:
export default defineNuxtConfig({
// ...
nitro: {
// ...
experimental: {
wasm: true,
},
},
// ...
})
Driver adapters and TypedSQL
TypedSQL lets you write fully type-safe SQL queries that integrate directly with Prisma Client. This feature is useful if you want the flexibility of writing SQL while still benefiting from Prisma's type-safety.
You can also use driver adapters together with TypedSQL to connect through JavaScript database drivers. TypedSQL works with all supported driver adapters except @prisma/adapter-better-sqlite3. For SQLite support, use @prisma/adapter-libsql instead.