Skip to main content

Connect your database

Connecting your database

To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL:

datasource db {
provider = "sqlserver"
url = env("DATABASE_URL")

The url is set via an environment variable, the following example connection URL uses SQL authentication, but there are other ways to format your connection URL


Adjust the connection URL to match your setup - see Microsoft SQL Server connection URL for more information.

Make sure TCP/IP connections are enabled via SQL Server Configuration Manager to avoid No connection could be made because the target machine actively refused it. (os error 10061)