RE: Re: PHP and MSSQL Connection on IIS 5.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thanks for the document. I have used the Administrative Tools to create a new ODBC data source, and it has been shown that the tests has been done successfully from the System DSN.

 My next question is this, with my ODBC driver compiled successfully, this is the connection string I have established to connect to the database using ODBC connection.

$connection_string = 'DRIVER={SQL Server};SERVER=localhost;DATABASE=master';
$user = 'user';
$pass = 'xxxxx';
odbc_connect($connection_string, $user, $pass) or die ("Cannot connect to database");
echo "You are connected to the database';

However, this has so far never given me any success. As I mentioned before, since this PHP script would be stored on the same server as the database, I only have to indicate the server as localhost, as I have had in the ODBC connection, right?

Or, is there anything else I have missed?
Thanks for your help.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@xxxxxxxxxxx
________________________________________
From: Elizabeth M Smith [auroraeosrose@xxxxxxxxxxxxx]
Sent: Tuesday, June 17, 2008 4:39 PM
To: Wei, Alice J.
Cc: php-windows@xxxxxxxxxxxxx
Subject: Re:  Re: PHP and MSSQL Connection on IIS 5.1

Wei, Alice J. wrote:
> Hi,
>
>   For ODBC connections, are you using MSSQL 2005? I am currently using Windows XP for the server with PHP 5.2.
>
>    I am currently using this version of the MS SQL server, and thus when I am seting up the ODBC connection, I notice that it keeps failing possibly because the SQL Server is indicated as 2000 and not even 2003. Would this make a difference?
>
> Thanks in advance.
>
> Alice
> ======================================================
> Alice Wei
> MIS 2009
> School of Library and Information Science
> Indiana University Bloomington
> ajwei@xxxxxxxxxxx
> _____________________

As long as you're using the right odbc connection string it shouldn't
matter - you shouldn't have to use a dsn even -

www.connectionstrings.com/?carrier=sqlserver has a nice listing of how
you should be formatting your connection strings

Remember that you need to be able to have permission to connect to the
database!  For PHP the easiest way to do this is to get TCP/IP working
for sqlserver and using sql level authentication, not windows
authentication.  You'll have to get into the client tools to get this
working properly, and it's been long enough since I had to mess with it
that I don't remember exactly where those settings are.

Thanks,
Elizabeth

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux