乐闻世界logo
搜索文章和话题

Which databases does TypeORM support?

2月17日 22:45

TypeORM supports multiple databases, including:

  1. MySQL / MariaDB: The most commonly used relational database
  2. PostgreSQL: Powerful open-source database
  3. SQLite: Lightweight embedded database
  4. Microsoft SQL Server: Microsoft's database system
  5. Oracle: Enterprise-level database
  6. MongoDB: NoSQL document database (through TypeORM's MongoDB support)
  7. CockroachDB: Distributed SQL database

Examples of configuring different databases:

typescript
// MySQL new DataSource({ type: 'mysql', host: 'localhost', port: 3306, username: 'root', password: 'password', database: 'test' }); // PostgreSQL new DataSource({ type: 'postgres', host: 'localhost', port: 5432, username: 'postgres', password: 'password', database: 'test' }); // SQLite new DataSource({ type: 'sqlite', database: './database.sqlite' });

The advantage of TypeORM is its unified API, making it very easy to switch between different databases.

标签:TypeORM