Re: PEAR DB/DataObjects and MSSQL
| From: | Frank M. Kromann | Date: | Tue, 09 Mar 2004 05:28:23 +0000 |
| Subject: | Re: PEAR DB/DataObjects and MSSQL | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11172@lists.php.net to get a copy of this message | ||
Hi Barry,
DB::MSSQL use the mssql extension for PHP. That means you have to compile
php using --with-mssql=/path/to/freetds (or you can use the ODBTP that
emulates the mssql extension).
freetds must be configured to match your SQL server (TDS version 5, 7 or
8). If you use an IP address to connect to the server freetds will use the
default configuration and that might not match your installation. You
should always create an entry in freetds.conf and use the alias when
connecting.
It is always a good idea to the freetds and plain php (native mssql
functions) before you try to use any form of abstraction layer (PEAR::DB,
PEAR::MDB or your own).
- Frank
> Hi folks,
> I'm in the process of setting up an application that will use a
> Linux/Apache (RH9.0, Apache 2.0) web-server that accesses data from a
> Windows SBS 2003 server running MSSQLSERVER.
>
> I built a small test harness to check the connection :
>
> <code>
> <?
> require_once ("DB.php");
> require_once('PEAR.php');
> require_once("Var_Dump.php");
> //$DSN = "mssql://hpfm:hpfm@192.168.6.200/master";
> $DSN = "mssql://hpfm:hpfm@SLSA1/Membership";
> $options = array('debug' => 3);
>
> $db =& DB::connect($DSN,$options);
> if (DB::isError($db))
> {
> /*
> * This is not what you would really want to do in
> * your program. It merely demonstrates what kinds
> * of data you can get back from error objects.
> */
> echo 'Failed Standard Message: ' . $db->getMessage() . "\n";
> Var_Dump::display($db);
> }
> else
> {
> echo "Yahoo!!! <b>we're connected! </b><br>";
> $db->disconnect();
> }
>
> // ...
>
>
> ?>
>
>
> </code>
>
> I get the following error message
> Failed Standard Message: DB Error: no such database
>
>
> To date I have done nothing in terms of configuring PHP or loading
> utilities such as ODBTP.
>
> Has anyone out there had much experience in this area that might help?
>
> Thanks
> Barry
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>