CodeIgniter Forums
Multiple Databases and Sessions Stored in DB - 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: Multiple Databases and Sessions Stored in DB (/showthread.php?tid=37310)



Multiple Databases and Sessions Stored in DB - El Forum - 01-05-2011

[eluser]Unknown[/eluser]
Lookings at the session library, looks like it is assumed ci_session table will be in the default DB.

(See System->Libraries->Session, version 1.7, Line 80)

I have a secondary DB config and the session table is in that.

According to the docs, to use multiple databases, you must capture output of load into $DB1 and $DB2, then use that as such (i.e. $DB1->query() etc.)

My questions:

Do I have to change the Session class or create my own to use a secondary DB?


Thanks,

Dan


UPDATE: Actually just changing line 80 from ->database() to ->database('second_db'); worked.