Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-11-2007, 02:22 PM
Junior Member
 
Join Date: Apr 2007
Posts: 2
Default Problem with connection to DB

Hi, can somebody help me with this problem? I am trying to connect to MySql DB like this :

PHP Code:
$params = array ('host' => ':/tmp/mysql50.sock',
                         
'username' => 'my_username',
                         
'password' => 'my_pass'
                         'dbname'   
=> 'my_db_name');

$db Zend_Db::factory('PDO_MYSQL'$params); 
And apache returns exeption like this :

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host ':/tmp/mysql50.sock' (3)' in my_path/lib/Zend/Db/Adapter/Pdo/Abstract.php:102 Stack trace: #0 my_path/lib/Zend/Db/Adapter/Abstract.php(143): Zend_Db_Adapter_Pdo_Abstract->_connect() #1

some other stuff

thrown in my_path/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 102

connection using mysql_connect() works OK.
Where should be problem? thanks for all answers.

Last edited by SpotSec : 05-02-2007 at 05:57 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2007, 05:52 PM
Cristian's Avatar
Administrator
 
Join Date: Feb 2007
Location: Sibiu, Romania
Posts: 101
Default

You forgot to add host to your connection.

If you are connecting to a local database server then using localhost for host parameter is just fine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-13-2007, 09:37 AM
Junior Member
 
Join Date: Apr 2007
Posts: 2
Default problem solved

I solved this problem, I've done it like this:

PHP Code:
$params = array ('unix_socket' => ':/tmp/mysql50.sock',
                                     
'username' => 'my_username',
                                     
'password' => 'my_pass'
                                     'dbname'   
=> 'my_db_name'); 

Last edited by SpotSec : 05-02-2007 at 05:58 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:11 PM.