SQL programming / SQL portability |
The database entity concept across different database engines.
Most database servers can handle multiple database entities (you can create multiple 'databases'), but this is not possible with all engines:
Database Server Type | Multiple Database Entities |
---|---|
IBM® DB2® UDB | Yes |
IBM Informix® | Yes |
Microsoft™ SQL Server | Yes |
MySQL | Yes |
Oracle Database Server | No |
PostgreSQL | Yes |
Sybase ASE | Yes |
SQLite | Yes |
When using a database server that does not support multiple database entities, you can emulate different databases with schema entities, but this requires you to check for the database user definition. Each database user must have privileges to access any schema, and to see any table of any schema without needing to set a schema prefix before table names in SQL statements.
dbi.database.dbname.dbtype.schema = "schema-name"
Some databases also allow you to define a default schema for each database user. When the user connects to the database, the default schema is automatically selected.