Skip to main content


This guide explains how to connect an application using Prisma Client to a PolyScale database cache.

Prisma is an open source next-generation ORM that consists of these tools:

When working with applications using Prisma, the addition of PolyScale can dramatically increase database performance. It does this by intelligently caching data, close to where your application runs. This has two primary benefits: increase database query execution times (all cached queries execute sub-millisecond) and dramatically reduce network latency by being physically closer, for faster connectivity and data transfer.

Use Case

This tutorial assumes that you have already connected a database to an application using Prisma as your database client. If you have not, you can find getting started instructions here.

To connect to your database via PolyScale instead, it is as simple as creating a PolyScale cache, and then replacing your original database connection details with those provided by PolyScale.

Step 1: Create PolyScale Cache

Before creating a PolyScale cache, make sure you have your current database host and port credentials, as you will need them to set up PolyScale.

  • In your PolyScale account, click on the New Cache button
  • Give the cache a Name
  • Select the Type of database you have
  • Enter the Host address for your existing database
  • Enter the Port used for your existing database
  • Click Create

When you create your cache, PolyScale will automatically run a network test to ensure it can make a TCP connection to your database from all edge network regions. If you see any locations that cannot connect, you can add their source IP's to your database IP Allow List.

You now have a working database cache configured.


PolyScale will automatically run a network connectivity test to ensure your database is accessible from all PolyScale PoPs. Be sure that you have added PolyScale's source IP addresses to your allow-list. You can read more here.

Step 2: Connect to your PolyScale Cache

To connect to the origin database via PolyScale simply update the DATABASE_URL in your .env file to use as the host and include your PolyScale Cache Id as described in our Getting Connected guide.

Here are examples for the connection URLs of the databases Prisma supports, being sure to replace CACHEID with your Cache Id (e.g 0ab23c45-6789-0de1-234f-abc5d67e8f90) :





Depending on the version of Postgres you are running you may see the following error when trying to connect with Prisma via PolyScale

User `postgres` was denied access on the database `postgres.public`

You can resolve this by adding a flag to your DATABASE_URL of channel_binding=disable.


Channel binding is a security measure to ensure that client and server are connecting to each other without anything in the middle. Because PolyScale is in the middle, channel binding must be disabled.

Version Be sure that you are using Prisma v4.8 or later; earlier versions of Prisma do not support the channel_binding flag.

Microsoft SQL Server

DATABASE_URL=sqlserver://;initial catalog=sample;user=CACHEID-janedoe;password=mypassword;

That's it. Now your Prisma application is connected to PolyScale. Database queries will be automatically cached (unless configured otherwise) to speed up query execution times and lower network latency.