Category Archives: database

Using UTF-8 as encoding for the database connection

I already wrote about this topic some time ago. In that post I described an approach using the configuration file of MySQL, and mentioned casually that you could execute “SET NAMES utf8” if you do not have access to the MySQL configuration file. But I did not show a solution for that case… Well, today […]

Store your sessions in a different database

Since RC5 it is possible to store the sessions in the database. You can enable that with setting the constant CAKE_SESSION_SAVE in app/config/core.php to “database” (make sure you have created the necessary table with app/config/sql/sessions.sql). By default, you create this session table in the same database which contains your data. But what to do if […]

Switch your database configuration based on some criteria

Currently, I am experimenting with unit tests. These tests should use an own database. And so I defined a “test” configuration in app/config/database.php: var $test = array(‘driver’ => ‘mysql’, ‘connect’ => ‘mysql_pconnect’, ‘host’ => ‘localhost’, ‘login’ => ‘user’, ‘password’ => ‘password’, ‘database’ => ‘project_name-test’, ‘prefix’ => ”); But it does not automatically use the “test” […]