CodeIgniter Forums
Multiple Databases and Sessions Stored in DB - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Multiple Databases and Sessions Stored in DB (/thread-37310.html)



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.