Welcome Guest, Not a member yet? Register   Sign In
Database query calls wrong DB instance!!
#11

[eluser]davidbehler[/eluser]
So what was your fix?

I image it's not a CI-only problem as in the end it uses the standard PHP function to connect to the database (atleast if I'm not mistaken). So either you would have had that problem without CI aswell or it's most likely not CI's fault.

I'm running a database server with multiple databases (all with the same user/password) on my local machine and not once did I end up in the wrong database.
#12

[eluser]Swedie[/eluser]
The fix was setting up separate mysql accounts for each database. I know I know... I should've done this from start.

It probably have this limit on multi use of the root account. Not sure same limit would apply on a non root account. Haven't tried.

On my local machine I have 2 (out of 5) multiple uses of root in the same CI application.
But on the live production server, I had 3 DB instances with the same root login.
So to repeat the error on your end, try having 3 different DB instanstances all with the same root login and make calls to them one after another. See if each query works as expected and tries to read from the correct DB.

I also believe now this probably isn't a CI problem in itself, but a fundamental limit to how PHP / MySQL works. A good limit actually, but the debugging of this isn't easy when there is no lead to what's causing it really. Maybe an error stating "no multi use of root login" would be fair. I'm sure some here would say that it's common knowledge though.




Theme © iAndrew 2016 - Forum software by © MyBB