Welcome Guest, Not a member yet? Register   Sign In
Issue: Core/Loader.php -> Db
#1

[eluser]Unknown[/eluser]
Hello,

I'm pretty new to codeingiter but I've think i've manage it pretty well so far. I have this issue which I can't figure out.

I do get this error upon loading the site:
Quote:A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 346

Now, you may think. Ah it's the database connection strings. But no, it's not. They are correct.

I checked them out by the debug script made by john_betong
Code:
echo '<pre>';
     print_r($db['default']);
  echo '</pre>';

  echo 'Trying to connect to database: ' .$db['default']['database'];
  $dbh=mysql_connect
  (
    $db['default']['hostname'],
    $db['default']['username'],
    $db['default']['password'])
    or die('Cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db['default']['database']);

    echo '<br />   Connected OK:'  ;
    die( 'file: ' .__FILE__ . '--&gt; Line: ' .__LINE__);

I get connected OK.

So on this line 346 I have this code in core/loader.php
Code:
// Load the DB class
$CI->db =& DB($params, $active_record);

Anyone?
Many thanks in advance!

#2

[eluser]Unknown[/eluser]
Ok I had the same problem, I was working on my project on a ubuntu/10.4 without complains but when I migrate to Lion OSX, I found this problem. Fixed with db_debug to false, my question is why?
#3

[eluser]Unknown[/eluser]
[quote author="patovala" date="1327450106"]Ok I had the same problem, I was working on my project on a ubuntu/10.4 without complains but when I migrate to Lion OSX, I found this problem. Fixed with db_debug to false, my question is why?[/quote]


I had this same error when I upgraded to Lion OSX and changing to $db['default']['db_debug'] = FALSE; fixed this error. Thanks!
#4

[eluser]Unknown[/eluser]
Code:
$db['default']['pconnect'] = FALSE;
i thinks it to false
#5

[eluser]ysh[/eluser]
Yes $db[‘default’][‘db_debug’] = false this solved my problem...I was using BigRock hosting....
If somebody would know why? And i was using this value as true on localhost..
#6

[eluser]Unknown[/eluser]
This post helped me debug my setup, figured I would post my fix to help others.

I am running on Amazon ec2 and was trying to connect to RDS. Turns out I didn't have my security groups setup. Tongue

#7

[eluser]Unknown[/eluser]
[quote author="John_Betong_002" date="1326277987"]Try

1. print_r($params) and print_r($active_record);

2. if the $params are still correct then simplify $active_record

3. echo mysql_error();

4. $db['default']['db_debug'] = true/false

5. $db['default']['stricton'] = true/false;
&nbsp;
&nbsp;



edit: removed duplicate 'db_debug' entry[/quote]


As the others have said
Code:
$db['default']['db_debug'] = FALSE
solved the same problem which I too was having.

I am interested why is it so &nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp; that the
Code:
$db['default']['db_debug'] = TRUE
created the problem ?


It used to run fine on my localhost but had to modify the 'db_debug' on the production server.
#8

[eluser]mesha85[/eluser]
I have the same problem and i tried to change the

Code:
$db['default']['db_debug'] = TRUE
to
Code:
$db['default']['db_debug'] = FALSE

but still doesn't work, can anyone please help me out? plzzzzzzz....:down:
#9

[eluser]Unknown[/eluser]
Same problem. I use print_r($params); but nothing shows...
#10

[eluser]Unknown[/eluser]
I am getting the same message, but I am only loading a model without a database.
If I change the debug to false, I don't get the error but it also stops at the line where I load to model.

I am using codeigniter version 2.1.3 on ubuntu 10




Theme © iAndrew 2016 - Forum software by © MyBB