PDO SQLite Driver not connecting |
[eluser]QuantumHive[/eluser]
Hi, I'm trying to use PDO to connect to a SQLite Database. Using Apache2.4 on Windows 7 with PHP 5.4.13 (pdo and sqlite extensions are enabled in php.ini. See this screenshot: http://puu.sh/2xtEF.jpg) I'm getting this error: Quote:PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' Database configs are: Code: $db['default']['hostname'] = ''; When debugging I found that the error was caused in the function dp_pconnect() in the file pdo_driver.php. The PDO constructor is called like this: Code: new PDO (";dbname=sqlite:c:/Apache24/htdocs/prac3/application/db/database3.sqlite", "", "", ...); Now, I tried to test this by calling my own PDO connection without the ;dbname= part: Code: new PDO ("sqlite:c:/Apache24/htdocs/prac3/application/db/database3.sqlite", "", "", ...); So what's going on here? Is this a bug or am I doing something wrong?
[eluser]TheFuzzy0ne[/eluser]
I'm pretty sure your DSN string needs to go into $db['default']['hostname'].
[eluser]QuantumHive[/eluser]
Code: $db[‘default’][‘hotstname’] = "sqlite:path/to/file.sqlite" Then what should $db['default']['database'] be?
[eluser]TheFuzzy0ne[/eluser]
I'm pretty sure you'd leave that empty, since the file itself is the database, and you specify that in your DSN string. I might be wrong. Someone please correct me if I am.
|
Welcome Guest, Not a member yet? Register Sign In |