Skip to content

Latest commit

 

History

History
232 lines (142 loc) · 11.9 KB

dev-guide-overview.md

File metadata and controls

232 lines (142 loc) · 11.9 KB
title summary aliases
Developer Guide Overview
Introduce the overview of the developer guide for TiDB Cloud and TiDB Self-Managed.
/tidb/dev/connectors-and-apis/
/appdev/dev/
/tidb/dev/dev-guide-outdated-for-laravel

Developer Guide Overview

Guides by language and framework

Build your application with the language you use by following the guides with sample codes.

Connect to TiDB Cloud over HTTPS in Edge Function.

Connect Next.js with mysql2 to TiDB Cloud.

Connect to TiDB Cloud with Prisma ORM.

Connect to TiDB Cloud with TypeORM.

Connect to TiDB Cloud with Sequelize ORM.

Connect Node.js with mysql.js module to TiDB Cloud.

Connect Node.js with node-mysql2 module to TiDB Cloud.

Connect AWS Lambda Function with mysql2 to TiDB Cloud.

Connect Django application with django-tidb to TiDB Cloud.

Connect to TiDB Cloud with MySQL official package.

Connect to TiDB Cloud with PyMySQL package.

Connect to TiDB Cloud with mysqlclient package.

Connect to TiDB Cloud with SQLAlchemy ORM.

Connect to TiDB Cloud with Peewee ORM.

Connect to TiDB Cloud with JDBC (MySQL Connector/J).

Connect to TiDB Cloud with MyBatis ORM.

Connect to TiDB Cloud with Hibernate ORM.

Connect Spring based application with Spring Data JPA to TiDB Cloud.

Connect to TiDB Cloud with MySQL driver for Go.

Connect to TiDB Cloud with GORM.

Connect Ruby on Rails application with Active Record ORM to TiDB Cloud.

Connect to TiDB Cloud with mysql2 driver.

In addition to these guides, PingCAP works with the community to support the third-party MySQL driver, ORMs and tools.

Use MySQL client software

As TiDB is a MySQL-compatible database, you can use many client software tools to connect to TiDB Cloud and manage the databases just like you did before. Or, use our command line tool to connect and manage your databases.

Connect and manage TiDB Cloud databases with MySQL Workbench.

Connect and manage TiDB Cloud databases with SQLTools extension in VSCode.

Connect and manage TiDB Cloud databases with DBeaver.

Connect and manage TiDB Cloud databases with DataGrip by JetBrains.

Additional resources

Learn other topics about developing with TiDB Cloud.

This guide is written for application developers, but if you are interested in the inner workings of TiDB or want to get involved in TiDB development, read the TiDB Kernel Development Guide for more information about TiDB.

This tutorial shows how to quickly build an application using TiDB, the possible use cases of TiDB and how to handle common problems.

Before reading this page, it is recommended that you read the Quick Start with TiDB Self-Managed.

TiDB basics

Before you start working with TiDB, you need to understand some important mechanisms of how TiDB works:

TiDB transaction mechanisms

TiDB supports distributed transactions and offers both optimistic transaction and pessimistic transaction modes. The current version of TiDB uses the pessimistic transaction mode by default, which allows you to transact with TiDB as you would with a traditional monolithic database (for example, MySQL).

You can start a transaction using BEGIN, explicitly specify a pessimistic transaction using BEGIN PESSIMISTIC, or explicitly specify an optimistic transaction using BEGIN OPTIMISTIC. After that, you can either commit (COMMIT) or roll back (ROLLBACK) the transaction.

TiDB guarantees atomicity for all statements between the start of BEGIN and the end of COMMIT or ROLLBACK, that is, all statements that are executed during this period either succeed or fail as a whole. This is used to ensure data consistency you need for application development.

If you are not sure what an optimistic transaction is, do NOT use it yet. Because optimistic transactions require that the application can correctly handle all errors returned by the COMMIT statement. If you are not sure how your application handles them, use a pessimistic transaction instead.

The way applications interact with TiDB

TiDB is highly compatible with the MySQL protocol and supports most MySQL syntax and features, so most MySQL connection libraries are compatible with TiDB. If your application framework or language does not have an official adaptation from PingCAP, it is recommended that you use MySQL's client libraries. More and more third-party libraries are actively supporting TiDB's different features.

Since TiDB is compatible with the MySQL protocol and MySQL syntax, most of the ORMs that support MySQL are also compatible with TiDB.

Read more

Need help?

Ask the community on Discord or Slack, or submit a support ticket.