Applications may encounter incompatibilities when using advanced or obscure features of a driver or ORM framework with partial support. If you encounter problems, please .
JavaScript/TypeScript
View support and resources for pg, Sequelize, Knex.js, TypeORM, or Prisma
JavaScript/TypeScript
View support and resources for pg, Sequelize, Knex.js, TypeORM, or Prisma
JavaScript Drivers
pg
Support level: FullTo install the Node.js pg driver:JavaScript/TypeScript ORM frameworks
Sequelize
Support level: FullTo install Sequelize and a CockroachDB Node.js package that accounts for some minor differences between CockroachDB and PostgreSQL:Knex.js
Support level: FullInstall Knex.js as described in the official documentation.For a simple but complete example app, see .TypeORM
Support level: FullInstall TypeORM as described in the official documentation.For a simple but complete example app, see .Prisma
Support level: FullTo install the Prisma ORM:Python
View support and resources for psycopg3, psycopg2, SQLAlchemy, Django, or peewee
Python
View support and resources for psycopg3, psycopg2, SQLAlchemy, Django, or peewee
Python Drivers
psycopg3
Support level: FullTo install the Python psycopg3 driver:psycopg2
Support level: FullTo install the Python psycopg2 driver:Python ORM frameworks
SQLAlchemy
Support level: FullTo install SQLAlchemy and a CockroachDB Python package that accounts for some differences between CockroachDB and PostgreSQL:Django
Support level: FullCockroachDB supports Django versions 3.1+.To install Django:- psycopg2, which has some prerequisites of its own. This package is recommended for production environments.
- psycopg2-binary. This package is recommended for development and testing.
The major version of
django-cockroachdb must correspond to the major version of django. The minor release numbers do not need to match.peewee
Support level: FullTo install peewee:Go
View support and resources for pgx, pq, or GORM
Go
View support and resources for pgx, pq, or GORM
Go Drivers
pgx
Support level: FullTo install the Go pgx driver:pq
Support level: FullTo install the Go pq driver:Go ORM frameworks
GORM
Support level: FullTo install GORM:Java
View support and resources for JDBC, Hibernate, or jOOQ
Java
View support and resources for JDBC, Hibernate, or jOOQ
We recommend using Java versions 8+ with CockroachDB.
COCKROACH_TLS_ENABLE_OLD_CIPHER_SUITES can be used to revert to the cipher suite configuration used prior to v22.2. You should set this environment variable only if you cannot use one of the default cipher suites, but you can use one of the disabled ones.SQL clients, intermediate proxies, or load balancers that do not support any cipher suites that CockroachDB supports will be unable to connect to CockroachDB clusters. For the full list of supported cipher suites, refer to Supported cipher suites.
A bug in the TLS 1.3 implementation in Java 11 versions lower than 11.0.7 and Java 13 versions lower than 13.0.3 makes the versions incompatible with CockroachDB.If an incompatible version is used, the client may throw the following exception:javax.net.ssl.SSLHandshakeException: extension (5) should not be presented in certificate_requestFor applications running Java 11 or 13, make sure that you have version 11.0.7 or higher, or 13.0.3 or higher.If you cannot upgrade to a version higher than 11.0.7 or 13.0.3, you must configure the application to use TLS 1.2. For example, when starting your app, use: $ java -Djdk.tls.client.protocols=TLSv1.2 appNameJava Drivers
JDBC
Support level: FullDownload and set up the latest Java JDBC driver as described in the official documentation.For a simple but complete example app, see .Java ORM frameworks
Hibernate
Support level: FullYou can use Gradle or Maven to get all dependencies for your application, including Hibernate. Only Hibernate versions 5.4.19 and later support the Hibernate CockroachDB dialect.If you are using Gradle, add the following to yourdependencies:<dependencies:org.hibernate.dialect.CockroachDB201Dialect corresponds to CockroachDB v20.1 and later, and org.hibernate.dialect.CockroachDB192Dialect corresponds to CockroachDB v19.2 and later.All dialect versions are forward-compatible (e.g., CockroachDB v20.1 is compatible with CockroachDB192Dialect), as long as your application is not affected by any backward-incompatible changes listed in your CockroachDB version’s . In the event of a CockroachDB version upgrade, using a previous version of the CockroachDB dialect will not break an application, but, to enable all features available in your version of CockroachDB, we recommend keeping the dialect version in sync with the installed version of CockroachDB.Not all versions of CockroachDB have a corresponding dialect yet. Use the dialect number that is closest to your installed version of CockroachDB. For example, use CockroachDB201Dialect when using CockroachDB v21.1 and later.jOOQ
Support level: FullYou can use Gradle or Maven to get all dependencies for your application, including jOOQ.For a simple but complete example app that uses Maven for dependency management, see .Ruby
View support and resources for pg or Active Record
Ruby
View support and resources for pg or Active Record
Ruby Drivers
pg
Support level: FullTo install the Ruby pg driver:Ruby ORM frameworks
Active Record
Support level: FullTo install Active Record, the pg driver, and a CockroachDB Ruby package that accounts for some minor differences between CockroachDB and PostgreSQL:The exact command above will vary depending on the desired version of Active Record. Specifically, version 6.0.x of Active Record requires version 6.0.x of the adapter and version 7.0.x of Active Record requires version 7.0.x of the adapter.
C
View support and resources for libpq
C
View support and resources for libpq
C Drivers
libpq
Support level: PartialInstall the C libpq driver as described in the official documentation.C# (.NET)
View support and resources for Npgsql
C# (.NET)
View support and resources for Npgsql
C# Drivers
Npgsql
Support level: Full-
Create a.NET project:
The
dotnetcommand creates a new app of typeconsole. The-oparameter creates a directory namedcockroachdb-test-appwhere your app will be stored and populates it with the required files. Thecd cockroachdb-test-appcommand puts you into the newly created app directory. -
Install the latest version of the Npgsql driver into the.NET project using the built-in nuget package manager:
Rust
View support and resources for rust-postgres
Rust
View support and resources for rust-postgres

