views:

55

answers:

2

Trying to learn a bit about PDO and is going through this tutorial. It has the following snippet of code:

<?php

try
{
    $db = new PDO('sqlite::memory');
    echo "SQLite created in memory.";

}
catch(PDOException $e)
{
    echo $e->getMessage();
}

When I run this I get the following exception message:

SQLSTATE[HY000] [14] unable to open database file

What does that mean? How can I get it to work? I am able to connect to a MySQL database and also a regular SQLite database file. So I know at least something is working...

I'm on Windows 7 64-bit with Apache 2.2.11 and PHP 5.3.0 (latest WampServer install). phpinfo() reports that I have pdo_sqlite with SQLite Library 3.6.15 enabled.

A: 

Not sure @ win permissions, but on *nix, SQLite needs write permision to the dir confining database files for temp files.

Devin Ceartas
Also good to know!
Svish
+1  A: 

You have to write

$db = new PDO('sqlite::memory:');

the trailing : is missing.

Mannaz
Un-believable... haha. Thanks :D
Svish