This is documentation for Kohana v2.3.x.
Status | Draft |
---|---|
Todo | Expand |
To configure the database there should be a file database.php in your application/config directory. If it isn't there you should copy it from the system/config directory. It will look something like this:
$config['default'] = array ( 'benchmark' => TRUE, 'persistent' => FALSE, 'connection' => array ( 'type' => 'mysql', 'user' => 'dbuser', 'pass' => 'p@ssw0rd', 'host' => 'localhost', 'port' => FALSE, 'socket' => FALSE, 'database' => 'kohana' ), 'character_set' => 'utf8', 'table_prefix' => '', 'object' => TRUE, 'cache' => FALSE, 'escape' => TRUE );
benchmark
is used to enable or disable benchmarkingpersistent
is used to enable or disable a persistent connectionconnection
array of specific parameters or supply a valid DSN identifier in the format: driver://user:password@server_or_socket/database character_set
which character_set to usetable_prefix
the table prefix to use for your tables, if anyobject
if set to TRUE, database results return objects by default, otherwise they return arrays.cache
enable or disable the query cacheescape
enable or disable automatic query builder escapingYou can have as many $config entries as you need. Each one needs a unique group identifier. You can use multiple config groups to connect to different databases in the same application.
The database library provides database access to your application using drivers.
Currently we have the following drivers available: