Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in

51 views
Skip to first unread message

Glitch

unread,
Oct 21, 2009, 7:39:53 AM10/21/09
to Php Object Generator
Has anyone come across this error.
I am using root as the username and no password in the configuration
file.
but for some reason its trying to connect as ODBC.

Has anyone come across this on the pog?

Joel

unread,
Oct 21, 2009, 12:58:28 PM10/21/09
to Php Object Generator
Personally never seen this. what happens when you use a password?

Robert Mortimer

unread,
Oct 21, 2009, 2:50:22 PM10/21/09
to php-object...@googlegroups.com
2009/10/21 Joel <joe...@gmail.com>:
>
> Personally never seen this. what happens when you use a password?
>
I've seen it on windows machines but I forgot exactly what the reason
was. It may have been failure to authenticate. I suspect that PHP on
windows connects to the local MySQL server via ODBC rather than
through a UNIX socket (for reasons that should be obvious from the
name).

Will phpMyAdmin work for you. If so have a look at the settings used there.

Rob

Gibson

unread,
Oct 22, 2009, 3:29:36 AM10/22/09
to php-object...@googlegroups.com
Hullo all,
Thanks for the response,i managed to fix it.
Problem was a php file inclusion,i wasnt including the configuration.php in a proper manner.
When i changed to the method below.

I created a load_shell_lib.php file below that loads files and required it once  in all scripts

$root_dir = '';

function require_dir_nest($directory,$except){
if(!$except){$except = array();}
$dir = opendir($directory);
/*echo "Dir is ".$directory." and Dir result is "; print_r($except); echo "<br>";*/
while(($file = readdir($dir)) !== false){
$path = $directory."/{$file}"; 
/*echo  "Path is ".$path." <br>";*/
if(!in_array($file,$except)){
if(!is_dir($path) && (strlen($file) > 2) && (substr(strtolower($file), strlen($file) - 4) === '.php')){
if(!include_once $path){
echo "Failed to include ".$path." <br>";
}
}elseif(is_dir($path)){
if(($file != '.') && ($file != '..') && ($file != '_notes')){
/*echo "entering level 2 for [".$path."] <br>";*/
require_dir_nest($path,'');
}
}
}
}
closedir($dir);
}

//Load database core files
require_dir_nest($root_dir."../database/core",'');

//Load database objects
require_dir_nest($root_dir."../database/objects",'');

Paris Paraskeva

unread,
Oct 22, 2009, 3:55:36 AM10/22/09
to php-object...@googlegroups.com

So you script loads all database objects regardless of what it being used????

 

I think that a bit ineffective!!! Specially if you have all sorts of different pog classes

 

It’s better to use php5 autoload function in order to load class objects whenever they are needed.

 

Can’t do that with include files thought (that contain functions not classes), so you will have to include those like you are doing  

 

Here is my autoloader function I am using for POG. I just include the file that contains this code in confuration.php and any php file that needs a pog class it loaded automatically.

 

// automatially load objects in objects folder

function __autoload($class_name)

{

                global $config;

                $path = $config['root-path'].'objects/class.'.strtolower($class_name).'.php';

    if(file_exists($path)){   

                require_once $path;

        return;

                }

}

 

Note that $config['root-path'] is something I am using which stores the absolute path of my script

 

Here is the code for it as well since I made it to find that automatically so I don’t have to find the path each time

 

 

function root_path() {

                $base_path =  dirname(__FILE__);

                if(!preg_match("/(\/)$/", $base_path)) $base_path = $base_path . '/';

                $base_path = str_replace("/includes/", "/", $base_path);

                $base_path = str_replace("\includes", "", $base_path);

    return $base_path;

}

 

$config['root-path'] = root_path();        

 

Again note that this function is inside an includes folder that is why I replace that from the path I am getting

 

 

Kindest Regards,

 

Paris Paraskeva

Managing Director

M.E. & E. United Worx Ltd

33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus

Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002

pa...@unitedworx.com

www.unitedworx.com

 

The information contained in this email message(and any attachments) is legally privileged and confidential information intended only for the use of the addressee(s) listed on this email. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution or copy of this email is strictly prohibited. If you have received this email in error, please notify us by telephone or email on the contact details shown on the end of this email. Thank you.


 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4531 (20091022) __________

 

The message was checked by ESET NOD32 Antivirus.

 

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4531 (20091022) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Gibson

unread,
Oct 22, 2009, 7:41:54 AM10/22/09
to php-object...@googlegroups.com
Paris,
Thanks for the info.
Reply all
Reply to author
Forward
0 new messages