 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
suzi167
Joined: 21 Apr 2008 Posts: 2
|
Posted: Mon Apr 21, 2008 10:32 pm Post subject: Help with DSN connection string |
|
|
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 |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1011
|
Posted: Tue Apr 22, 2008 8:18 am Post subject: |
|
|
| $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 |
|
 |
suzi167
Joined: 21 Apr 2008 Posts: 2
|
Posted: Tue Apr 22, 2008 10:13 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|
|