NYCPHP Meetup

NYPHP.org

[nycphp-talk] Connect to MSSQL Database with PHP and ADODB

Daniel Convissor danielc at analysisandsolutions.com
Wed Dec 7 20:08:30 EST 2005


On Wed, Dec 07, 2005 at 07:30:33PM -0500, Randal Rust wrote:
> I have inherited a .NET app that I am converting over to PHP/MySQL.
> The first big hurdle is to convert the database.
> 
> I have setup SQL Server Express 2005 and done a restore of the DB, so
> I can at least see the structure and the data.
> 
> I am trying to use ADODB to connect to the database, but with no luck.
> I set SQL server up so that it uses Windows Authentication when I
> login (no username/password) required.

Well, that's probably your problem right there.  You're running SQL Server 
(just kidding).  Your problem is probably the "Windows Authentication" 
setting.

Where are you running your PHP scripts from?  If it's via the web server, 
I certainly hope the account the web server is running as doesn't have 
permission to get in.

I have my SQL Server 2000 Authentication set to "SQL Server and Windows."  
This way I can manually specify the user name and password when calling 
mssql_connect() in my scripts.

Regardless of the authentication mechanism, you'll need to have the users 
registerd in the SQL Server's "Logins."

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list