This is documentation for Kohana v2.3.x.
Status | Draft |
---|---|
Todo | Proof read |
Connecting with the database library is very simple. Most of the time, you never need to think about it! Kohana has the following features to make your connection life much easier:
Kohana will not connect to your database until it needs to perform a query or get some table metadata. This is useful when you employ query or page caching, so you don't use a connection when it isn't needed.
Kohana uses the default behaviors in native php database methods to cache the database connection when using the same database group with multiple database objects.
Kohana has the ability to connect to multiple databases at once by simply having multiple config groups, and creating new objects with them.
$db1 = new Database('db1'); $db2 = new Database('db2');
where db1 and db2 would be config groups in your database configuration.