# Database drivers (/docs/orm/v6/overview/databases/database-drivers)

Location: ORM > v6 > Core Concepts > Supported databases > Database drivers

Default built-in drivers [#default-built-in-drivers]

One of Prisma Client's components is the [Query Engine](/orm/v6/more/internals/engines) (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.

> [!NOTE]
> 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](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
> 
> In Prisma ORM 7, the default generator configuration is:
> 
> ```prisma
> generator client {
>   provider = "prisma-client"
>   output   = "../generated/prisma"
> }
> ```
> 
> Note that [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) are required when using the query compiler.
> 
> You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.

<img alt="Query flow from the user application to the database with Prisma Client" src="/img/v6/orm/overview/databases/images/drivers/qe-query-execution-flow.png" width="1280" height="445" />

Driver adapters [#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.

<img alt="Query flow from the user application to the database using Prisma Client and driver adapters" src="/img/v6/orm/overview/databases/images/drivers/qe-query-engine-adapter.png" width="1338" height="734" />

There are two different types of driver adapters:

* [Database driver adapters](#database-driver-adapters)
* [Serverless driver adapters](#serverless-driver-adapters)

> **Note**: Driver adapters enable [edge deployments](/orm/v6/prisma-client/deployment/edge/overview) of applications that use Prisma ORM.

Database 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 adapters for the following drivers:

* PostgreSQL
  * [`pg`](/orm/v6/overview/databases/postgresql#using-the-node-postgres-driver)
* Prisma Postgres
  * [`@prisma/adapter-ppg`](/postgres/database/serverless-driver#use-with-prisma-orm)
* MySQL/MariaDB
  * [`mariadb`](/orm/v6/overview/databases/mysql#using-the-mariadb-driver)
* SQLite
  * [`better-sqlite3`](/orm/v6/overview/databases/sqlite#using-the-better-sqlite3-driver)
  * [`libSQL`](/orm/v6/overview/databases/turso#how-to-connect-and-query-a-turso-database) (Turso)
* MS SQL Server
  * [`node-mssql`](/orm/v6/overview/databases/sql-server#using-the-node-mssql-driver)

Serverless 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 ORM maintains the following serverless driver adapters:

* [Prisma Postgres](/postgres/database/serverless-driver#use-with-prisma-orm)
* [Neon](/orm/v6/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm) (and Vercel Postgres)
* [PlanetScale](/orm/v6/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
* [Cloudflare D1](/orm/v6/overview/databases/cloudflare-d1)

Community-maintained database 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:

* [TiDB Cloud Serverless Driver](https://github.com/tidbcloud/prisma-adapter)
* [PGlite - Postgres in WASM](https://github.com/lucasthevenet/pglite-utils/tree/main/packages/prisma-adapter)

How to use 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:

* [PostgreSQL](/orm/v6/overview/databases/postgresql#using-the-node-postgres-driver)
* [Prisma Postgres](/postgres/database/serverless-driver#use-with-prisma-orm)
* [MySQL/MariaDB](/orm/v6/overview/databases/mysql#using-the-mariadb-driver)
* [MS SQL Server](/orm/v6/overview/databases/sql-server#using-the-node-mssql-driver)
* [Neon](/orm/v6/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm)
* [PlanetScale](/orm/v6/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
* [Turso](/orm/v6/overview/databases/turso#how-to-connect-and-query-a-turso-database)
* [Cloudflare D1](/orm/v6/overview/databases/cloudflare-d1)

Notes about using driver adapters [#notes-about-using-driver-adapters]

New driver adapters API in v6.6.0 [#new-driver-adapters-api-in-v660]

In [v6.6.0](https://github.com/prisma/prisma/releases/tag/6.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 [#before-660]

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:

```typescript
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 [#660-and-later]

As of the 6.6.0 release, you instantiate the driver adapter *directly* with the options of your preferred JS-native driver.:

```typescript
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 [#driver-adapters-and-database-connection-configuration]

In Prisma ORM 7, the database connection URL is configured in [`prisma.config.ts`](/orm/v6/reference/prisma-config-reference). 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:

```ts
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.

> [!NOTE]
> Tuning pool sizes, timeouts, or other connection parameters
> 
> See the [connection pool guide](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool) for the Prisma ORM v7 driver adapter defaults and how they map from Prisma ORM v6 URL parameters.

> [!NOTE]
> Prisma timeouts
> 
> 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](/orm/v6/prisma-client/queries/transactions#transaction-options).

Driver adapters and custom output paths [#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`:

```prisma
generator client {
  provider = "prisma-client"
  output   = "../src/generated/prisma"
}
```

You can reference Prisma Client using a relative path from your application code:

```ts
import { PrismaClient } from "./generated/prisma/client";

const client = new PrismaClient();
```

Alternatively, you can use a linked dependency for cleaner imports.

  

#### npm

  

  <CodeBlockTab value="npm">
    ```bash
    npm add db@./generated/prisma
    ```

#### pnpm

```bash
npm add db@./generated/prisma
# couldn't auto-convert command
```

#### yarn

```bash
npm add db@./generated/prisma
# couldn't auto-convert command
```

#### bun

```bash
npm add db@./generated/prisma
# couldn't auto-convert command
```
    
  </CodeBlockTab>

#### pnpm

```bash
pnpm add db@link:./generated/prisma
```

#### yarn

```bash
yarn add db@link:./generated/prisma
```

Now, you should be able to reference your generated client using `db`!

```ts
import { PrismaClient } from "db";

const client = new PrismaClient();
```

Driver adapters and specific frameworks [#driver-adapters-and-specific-frameworks]

Nuxt [#nuxt]

Using a driver adapter with [Nuxt](https://nuxt.com/) to deploy to an edge function environment does not work out of the box, but adding the `nitro.experimental.wasm` configuration option fixes that:

```ts
export default defineNuxtConfig({
  // ...
  nitro: {
    // ...
    experimental: {
      wasm: true,
    },
  },
  // ...
});
```

Driver adapters and TypedSQL [#driver-adapters-and-typedsql]

[TypedSQL](/orm/v6/prisma-client/using-raw-sql/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`](https://www.npmjs.com/package/@prisma/adapter-libsql) instead.

## Related pages

- [`Cloudflare D1`](https://www.prisma.io/docs/orm/v6/overview/databases/cloudflare-d1): Guide to Cloudflare D1
- [`CockroachDB`](https://www.prisma.io/docs/orm/v6/overview/databases/cockroachdb): Guide to CockroachDB
- [`Microsoft SQL Server`](https://www.prisma.io/docs/orm/v6/overview/databases/sql-server): This page explains how Prisma can connect to a Microsoft SQL Server database using the Microsoft SQL Server database connector.
- [`MySQL/MariaDB`](https://www.prisma.io/docs/orm/v6/overview/databases/mysql): This page explains how Prisma can connect to a MySQL or MariaDB database using the MySQL database connector.
- [`Neon`](https://www.prisma.io/docs/orm/v6/overview/databases/neon): Learn how to use Prisma ORM with Neon serverless PostgreSQL