I'm following the chapter called "Create a Model and Database Table". When I run 'php scripts/load.mysql.php' it says:
SQLSTATE[42000] [1102] Incorrect database name '/home/tirengarfio/workspace/ZendFW/gaziende/application/../data/db/guestbook-dev.db'
So I just tried to change the line
- Code: Select all
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-dev.db"
to
- Code: Select all
resources.db.params.dbname = "guestbook-dev"
and created a new database called guestbook, but I get another error about the "guestbook" is not a file, exactly:
PHP Warning: file_get_contents(/home/tirengarfio/workspace/ZendFW/gaziende/scripts/data.mysql.sql): failed to open stream: No such file or directory in /home/tirengarfio/workspace/ZendFW/gaziende/scripts/load.mysql.php on line 81
This is the code around the line 81 error (checkout what var_dump() returns):
- Code: Select all
// Check to see if we have a database file already
$options = $bootstrap->getOption('resources');
$dbFile = $options['db']['params']['dbname'];
if (file_exists($dbFile)) {
unlink($dbFile);
}
// this block executes the actual statements that were loaded from
// the schema file.
try {
$schemaSql = file_get_contents(dirname(__FILE__) . '/schema.mysql.sql');
// use the connection directly to load sql in batches
$dbAdapter->getConnection()->exec($schemaSql);
var_dump($dbFile);die(); // this returns "guestbook-dev"
chmod($dbFile, 0666);
So how should I set the name for the database connection?
Note: the example of the tutorial is for Sqlite and I'm trying to use MySQL. Is that point? I never used Sqlite.
Regards
Javi

