![]() |
code igniter and ms access - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: code igniter and ms access (/showthread.php?tid=12128) |
code igniter and ms access - El Forum - 10-07-2008 [eluser]Unknown[/eluser] I'm trying to use Microsoft Access as the db for a demo project that I'm thinking of doing in Code Igniter. Ignoring the possible folly of using MS Access, I haven't been able to figure out precisely how the connection string corresponds to the framework's db settings. In straight php, I can use this code to connect to an access db: Code: $db_connection = odbc_connect( How do those strings correspond to the Code Igniter db settings? This doesn't seem to be quite working (though it's not exactly throwing an error, either): Code: $db['access']['hostname'] = "{Microsoft Access Driver (*.mdb)}"; Oh, BTW, I'm running a xampp install of apache under xp if that matters. code igniter and ms access - El Forum - 10-07-2008 [eluser]Unknown[/eluser] Ok, I figured out that it should be something like: Code: $db['default']['hostname'] = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:/path/to/db.mdb"; However, I seem to have run into some bugs in the system. I can tell that it's using CI_DB_odbc_driver->db_connect() to connect to the db, which is located in system/database/drivers/odbc/odbc_driver.php. For whatever reason, the $this object in there doesn't seem to have any of the settings from database.php in it, so I have to re-add them there to get it to work. I also have to add $this->db->dbdriver = "odbc"; to my controller right after the $this->load->database(); call. |