New to PHP, can I use MS SQL Server2000??

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ric2003
Forum Newbie
Posts: 5
Joined: Thu Jan 16, 2003 7:41 am

New to PHP, can I use MS SQL Server2000??

Post by ric2003 »

Is it possible to use SQL Server2000 to run along side PHP instead of MySQL?

I only ask as I have access to SQL Server at work and would like to utilise it if possible.
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

That shouldn't be a problem..

http://www.php.net/manual/en/ref.mssql.php

edit/add: If you are running from a host without the ms-sql clients or non-bill-gates platform you can use ODBC instead..
rathlon
Forum Commoner
Posts: 45
Joined: Sun Nov 10, 2002 8:07 pm

Post by rathlon »

edit/add: If you are running from a host without the ms-sql clients or non-bill-gates platform you can use ODBC instead
Do you mean if he has a web-server on another machine besides the one where his MSSQL svr is running? In that case he can use the odbc? How / where would you get info for using, how it works, and code examples of the odbc?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

Yeah I am not familiar with Bill Gates SQL/RDBMS, but I assume that microsoft provides an ODBC driver, at least for windows, from what I read around, it appears that Sybase is using the same driver(s)(?)

So I believe that if your webserver is not on the same machine and/or PHP does not have the support for ms-sql (for whatever reason, missing ms-sql clients etc) you can use ODBC (That would reequire that your PHP is compiled with ODBC support).

If there exists no ODBC-driver for your OS/ODBC Manager (On Linux, the iODBC manager or UnixODBC is most commonly used), you can use OpenLinks generic ODBC driver, which supports MS-SQL.. OpenLink even has a request-broker system which allows you to bridge ODBC to ODBC between machines for accessing even if you don't have a direct-access driver for your current platform..

The code is very similar to any other PHP database interraction..
odbc_connect($dsn,$user,$pwd) and such, see the PHP manual for details on that.

For help/info on setting up ODBC on Linux/Unix I recommend visiting

http://www.unixodbc.org
http://www.iodbc.org
(Note, you only need one of them, not both)

http://www.openlinksw.com

If you are using Debian (Woody) you are pleased with PHP with ODBC/UnixODBC easily installable, all you need to do is to add the driver, a DSN and slightly edit php.ini to include the ODBC support..
Post Reply