Welcome Guest, Not a member yet? Register   Sign In
Getting No Such Table error with Sqlite 3
#1

[eluser]johnnyForums[/eluser]
I installed the PDO fix for sqlite 3 and have it running. I get no errors when loading the database.

But when I do scaffolding I get:
No such table

The table is actually northwind from microsoft and has a table named customers. I have tried customers and Customers. The only thing I can see happening is that in my folder where I have my sqlite database is that CodeIgniter creates a "ghost" of the database file with the same name as the master. This "ghost" has the same name but is of zero size.



Can anyone help?

edit: I also tried it with just $this->db->get('customers');
but I get the same error and the same ghost database.

This is the wiki I followed:

http://codeigniter.com/wiki/PDO_SQLite3/


I figured it out it is creating the database instead of trying to read my existing database. I change chang the name of the database to anything I want and CI will create the database in my folder.

Why is it doing this??

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = 'sqlite:'.APPPATH.'db/nwind2009.db';
$db['default']['dbdriver'] = "pdo";
#2

[eluser]Unknown[/eluser]
i was searching about this topic and found nothing on internet but google brings me here but no replies .
so i think we should ask sqlite team on there official site .
#3

[eluser]johnnyForums[/eluser]
[quote author="Austin004" date="1285758976"]i was searching about this topic and found nothing on internet but google brings me here but no replies .
so i think we should ask sqlite team on there official site .[/quote]

Thank you, but I humbly disagree.

In the database.php file I can put in the name of any database and CI creates the database. For whatever reason the sqlite PDO driver is creating a database instead of reading one. I don't even have to have a sqlite database in the folder. CI creates it. I don't know why.

edit: this was wrong. PDO was creating it. No CI.
#4

[eluser]johnnyForums[/eluser]
I figured this out. I was on Windows with PHP and trying to connect but instead it would create a new database. As documented by PDO if you try and connect to a database and it isn't there it will try and create the database. I was putting the wrong extension on my sqlite database .db instead of .db3. It was creating a new db and then trying to read that new database. After I put .dbe It worked fine. I did not use the wiki pdo stuff mentioned above, though. I did a straight PDO connection in my model and returned that into my controller. No activerecord.




Theme © iAndrew 2016 - Forum software by © MyBB