Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e446a118
Commit
e446a118
authored
Sep 06, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added CURBID to the docs
parent
d6ff097c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
database-basics.md
docs/guide/database-basics.md
+12
-3
No files found.
docs/guide/database-basics.md
View file @
e446a118
...
@@ -2,8 +2,14 @@ Database basics
...
@@ -2,8 +2,14 @@ Database basics
===============
===============
Yii has a database access layer built on top of PHP's
[
PDO
](
http://www.php.net/manual/en/ref.pdo.php
)
. It provides
Yii has a database access layer built on top of PHP's
[
PDO
](
http://www.php.net/manual/en/ref.pdo.php
)
. It provides
uniform API and solves some inconsistencies between different DBMS. By default Yii supports MySQL, SQLite, PostgreSQL,
uniform API and solves some inconsistencies between different DBMS. By default Yii supports the following DBMS:
Oracle and MSSQL.
-
[
MySQL
](
http://www.mysql.com/
)
-
[
SQLite
](
http://sqlite.org/
)
-
[
PostgreSQL
](
http://www.postgresql.org/
)
-
[
CUBRID
](
http://www.cubrid.org/
)
(
version
9.1.0 and higher).
-
Oracle
-
MSSQL
Configuration
Configuration
...
@@ -22,6 +28,7 @@ return array(
...
@@ -22,6 +28,7 @@ return array(
'dsn'
=>
'mysql:host=localhost;dbname=mydatabase'
,
// MySQL, MariaDB
'dsn'
=>
'mysql:host=localhost;dbname=mydatabase'
,
// MySQL, MariaDB
//'dsn' => 'sqlite:/path/to/database/file', // SQLite
//'dsn' => 'sqlite:/path/to/database/file', // SQLite
//'dsn' => 'pgsql:host=localhost;port=5432;dbname=mydatabase', // PostgreSQL
//'dsn' => 'pgsql:host=localhost;port=5432;dbname=mydatabase', // PostgreSQL
//'dsn' => 'cubrid:dbname=demodb;host=localhost;port=33000', // CUBRID
//'dsn' => 'sqlsrv:Server=localhost;Database=mydatabase', // MS SQL Server, sqlsrv driver
//'dsn' => 'sqlsrv:Server=localhost;Database=mydatabase', // MS SQL Server, sqlsrv driver
//'dsn' => 'dblib:host=localhost;dbname=mydatabase', // MS SQL Server, dblib driver
//'dsn' => 'dblib:host=localhost;dbname=mydatabase', // MS SQL Server, dblib driver
//'dsn' => 'mssql:host=localhost;dbname=mydatabase', // MS SQL Server, mssql driver
//'dsn' => 'mssql:host=localhost;dbname=mydatabase', // MS SQL Server, mssql driver
...
@@ -34,8 +41,10 @@ return array(
...
@@ -34,8 +41,10 @@ return array(
// ...
// ...
);
);
```
```
Please refer to the
[
PHP manual
](
http://www.php.net/manual/en/function.PDO-construct.php
)
for more details
on the format of the DSN string.
After the component is configured you can access it using the following syntax:
After the co
nnection co
mponent is configured you can access it using the following syntax:
```
php
```
php
$connection
=
\Yii
::
$app
->
db
;
$connection
=
\Yii
::
$app
->
db
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment