|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18360 Can't connect to database with an alias dns
Submitted: 2002-07-15 14:25 UTC Modified: 2002-08-01 11:45 UTC
From: vania at fe dot up dot pt Assigned:
Status: Not a bug Package: PEAR related
PHP Version: 4.2.0 OS: Win 2K
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: vania at fe dot up dot pt
New email:
PHP Version: OS:


 [2002-07-15 14:25 UTC] vania at fe dot up dot pt
I'm using PHP 4.2.0 with PEAR and IIS.

Using PEAR DB I can't connect to a MSSQL database using an alias dns for the host param in $dsn.
From that machine if I make a ping to that alias I get a reply, so I think it's not a network problem.

With a similar script in ASP it easily connects to database with this alias, so it might be a PEAR bug.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-16 06:46 UTC]
For getting support about how to use PEAR libraries please go to Btw you could try to read the output of:

require_once 'DB.php';

As I said, until you don't provide specific data on where something fails or how to reproduce the problem, please do not use the bug system.

Tomas V.V.Cox
 [2002-07-16 09:53 UTC] vania at fe dot up dot pt
I used the bug system, because I hadn't any problems using PEAR DB with the real dns to the database server. 

Here is the output of print_r(DB::connect($dsn)):

With the real dns to the database server, I get:

db_mssql Object ( [connection] => Resource id #1 [phptype] => mssql [dbsyntax] => mssql [prepare_tokens] => Array ( ) [prepare_types] => Array ( ) [transaction_opcount] => 0 [autocommit] => 1 [_db] => <DATABASE_NAME> [_debug] => [_default_error_mode] => [_default_error_options] => [_default_error_handler] => [_error_class] => DB_Error [_expected_errors] => Array ( ) [features] => Array ( [prepare] => [pconnect] => 1 [transactions] => 1 [limit] => emulate ) [errorcode_map] => Array ( ) [type] => [prepared_queries] => [prepare_maxstmt] => 0 [last_query] => [fetchmode] => 1 [fetchmode_object_class] => stdClass [options] => Array ( [persistent] => [optimize] => performance [debug] => 0 [seqname_format] => %s_seq ) [dbh] => [dsn] => Array ( [phptype] => mssql [dbsyntax] => mssql [username] => <USERNAME> [password] => [protocol] => tcp [hostspec] => <HOST> [port] => [socket] => [database] => <DATABASE_NAME> ) ) 

(I replaced username, host, database with <USERNAME>, <HOST>, <DATABSE_NAME>)

With the alias to the dns I get this output:

db_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => -24 [message] => DB Error: connect failed [userinfo] => <DSN> [callback] => ) DB Error: connect failed

I guess it's not a problem with how to use PEAR DB because now I have a stable system using PEAR DB for a few months.

 [2002-07-17 01:52 UTC]
Do you get the same problem using the native PHP functions?
 [2002-08-01 11:45 UTC]
No feedback. Please reopen this bug if you feel that the problem is a PEAR DB bug.


Tomas V.V.Cox
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 19:01:28 2024 UTC