Re: PEAR question about DB connet of MSSQL
| From: | Paul Cooper | Date: | Wed, 28 Aug 2002 13:02:15 +0000 |
| Subject: | Re: PEAR question about DB connet of MSSQL | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8708@lists.php.net to get a copy of this message | ||
The pear documentation is useful
http://pear.php.net/manual/en/core.db.tut_connect.php
I think your code should be,
$dsn = "mssql://phpuser:123456@123.123.123/members";
$db = DB::connect($dsn);
// check error
if( DB::isError($db) ) {
die($db->getMessage());
}
This should work assuming all the correct php modules are installed to
connect to mssql (freetds, etc).
HTH,
Paul
On Wed, 2002-08-28 at 13:11, Claire@Hinet wrote:
> Dear Sir/Madam:
>
> Please forget my poor english.
>
> How can I connet MicroSoft SQL server by using Pear?
>
> Here is my code:
> ----------------------------------------------------
>
> PHP:
> $MsSQL = new DB;
> $DSN = "mssql://phpuser:123456@123.123.123/members";
> $DB = DB::connect($DSN);
>
> // check error
> if( $MsSQL->isError($DBH) ) {
> echo $MsSQL->errorMessage($DBH);
> die();
> }
>
>
>
> ----------------------------------------------------
>
>
> I had successed in Mysql while use such configuration.
> But I don't know why it return a error message:"No such database" when I
> used MSSQL.
>
> (I do sure that the database named 'members' exists.)
>
> Thanks for ur help.
>
>
> Best Regards,
>
> Claire Y. Huang
>
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
-----------------------------------------------------------------
Paul Cooper | Tel: 0121 331 7858
Senior Programmer and Database Engineer | Fax: 0121 331 7859
UCEcom | mailto:pgc@ucecom.com
University of Central England | http://www.ucecom.com
Birmingham, B4 7DX |
-----------------------------------------------------------------