ID:               45294
 Updated by:       [email protected]
 Reported By:      lowee at lowee dot net
-Status:           No Feedback
+Status:           Feedback
 Bug Type:         PDO related
 Operating System: windows 2003
 PHP Version:      5.2.6
 New Comment:

If you are on windows, please try a 5.2 snapshot.
(http://windows.php.net/snapshots/)


Previous Comments:
------------------------------------------------------------------------

[2009-08-26 11:20:38] mayurika at conceptinfoway dot net

Same issue with me:
Neither PDO lib is working nor MSSQL

I have tried both  

1) MSSQL: 
try 
                {
                        $pdo = new PDO
("mssql:host=".$servername.":".$port.";dbname=".$dbname,$username,$password);
                } 
                catch (PDOException $e)
                {
                        echo "Failed to get DB handle: " . $e->getMessage() . 
"\n";
                        exit;
                }

Error is: Failed to get DB handle: could not find driver 
2) PDO-lib

                try 
                {
                        $pdo = new PDO
("dblib:host=".$servername.":".$port.";dbname=".$dbname,$username,$password);
                } 
                catch (PDOException $e)
                {
                        echo "Failed to get DB handle: " . $e->getMessage() . 
"\n";
                        exit;
                }
Error is: Failed to get DB handle: SQLSTATE[HY000] Server is
unavailable or does not exist. (severity 9)

------------------------------------------------------------------------

[2008-07-22 23:32:43] kian dot mohageri at gmail dot com

Very similar problem here with pdo_dblib.  Works fine under Apache
module, but not CLI.

I've tried to ensure everything was built correctly.

<?php

$user = 'foo';
$pass = 'bar';
$dbh = new PDO('dblib:host=odyssey:2638;dbname=odyssey', $user,
$pass);

?>

> php testpdo.php

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000] Server is unavailable or does not exist. (severity 9)'
in /usr/home/kian/public_html/testpdo.php:5
Stack trace:
#0 /usr/home/kian/public_html/testpdo.php(5):
PDO->__construct('dblib:host=odys...', 'foo', 'bar')
#1 {main}
  thrown in /usr/home/kian/public_html/testpdo.php on line 5

> php -v
PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 22 2008
16:30:13) (DEBUG)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

FreeBSD 7.0.

------------------------------------------------------------------------

[2008-07-14 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-07-06 12:05:51] [email protected]

Check what php.ini file is actually loaded. Most likely you're just
missing the proper extensions. Then change that script a bit:

<?php

define('DB_HOST','192.168.1.20');
define('DB_NAME','db1');
define('DB_USER','user');
define('DB_PASS','pass');
try {
  $pdo = new
PDO('mssql:host='.DB_HOST.'dbname='.DB_NAME,DB_USER,DB_PASS);
}catch (PDOException $e) {
  print $e->getMessage();
}
?>

And post the output here.


------------------------------------------------------------------------

[2008-06-17 11:13:30] lowee at lowee dot net

Description:
------------
php cli with pdo and ms sql
it is working on any web browser but on php cli it is not working 

Reproduce code:
---------------
        define('DB_HOST','192.168.1.20');
        # mtc_awdb
        # mtc_hds
        define('DB_NAME','db1');
        define('DB_USER','user');
        define('DB_PASS','pass');

        $dbhandle = mssql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't
connect to SQL Server on");
        try {
         $pdo = new
PDO('mssql:host='.DB_HOST.';dbname='.DB_NAME,DB_USER,DB_PASS);
        }catch (PDOException $e) {
                        print $e->getMessage();
                }

Expected result:
----------------
to show me that it is connected


Actual result:
--------------
1 - SQLSTATE[01002] Unable to connect: SQL Server is unavailable or
does not exist.
(severity 9)
2 - SERVER not available 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45294&edit=1

Reply via email to