DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> PEAR Forum - Forum for PHP Extension and Application Repository

PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Help with DSN connection string

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PEAR Forum Forum Index -> General PEAR questions
View previous topic :: View next topic  
Author Message
suzi167



Joined: 21 Apr 2008
Posts: 2

PostPosted: Mon Apr 21, 2008 10:32 pm    Post subject: Help with DSN connection string Reply with quote

Hello,

I have the following issue:

I installed Microsoft SQL server Express and I have Windows Authentication as the authentication of the server.

Also I downloaded the Northwind database. I can open the database with the SQL server Management studio and execute queries against it.

From my PHP code I am trying to connect to the database. Here is my PHP function:

Code:

<?php
function test()
{
 require_once "PEAR.php";
 require_once 'DB.php';

 $options = array
    (
    'debug'       => 2,
    'portability' => DB_PORTABILITY_ALL,
     );

$dsn = array(
    'phptype'  => 'mssql',
    'username' => 'suzi167',
    'password' => '1234',
    'hostspec' => 'localhost',
    'database' => 'NORTHWIND',
);
 $db =& DB::connect($dsn, $options);
     if (PEAR::isError($db))
        {
           die($db->getMessage());
        }
   
 $db->disconnect();

}
?>



When I run the code I see that it tries to connect to the database but ultimately I get the message:

DB Error: connect failed

Can you please give me any suggestions as to what am I doing wrong.
I tried installing SQL server with SQL server authentication but the only option I get during installation is Mixed Authentication or Windows Authentication....could the problem be the fact that I am using Windows Authentication?

Thanks in advance

Susan
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Tue Apr 22, 2008 8:18 am    Post subject: Reply with quote

$db->getDebugInfo() in addition to $db->getMessage() in the die() call should give you more details about why the connecting has failed.
Back to top
View user's profile Send private message
suzi167



Joined: 21 Apr 2008
Posts: 2

PostPosted: Tue Apr 22, 2008 10:13 pm    Post subject: Reply with quote

Thanks for the reply.
I changed my database from Microsoft SQL Server to be SQLite and all my problems went away.

Susan
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PEAR Forum Forum Index -> General PEAR questions All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software