Help - Search - Members - Calendar
Full Version: Access from website => SQL Server 2005 on local network?
The Planet Forums > System Administration > Web Hosting
TeddyReddy
This seems like such a simple problem. And it must be so common! wacko.gif

I have a site that is running PHP & MySQL. I would like it to pull data from my local server, which running MSSQL Server 2005.

I thought that I could open port 1433 locally and have the site connect to my SQL server. But I was told by The Planet tech support:

"Dear Customer,

Unfortunately linux does not have a MSSQL client to pull real time data. At this time i do not know of any solution that would produce the results you are looking for. I would suggest forums.theplanet.com, Google, or webhostingtalk.com. These forums are very helpful in getting information within a broader spectrum.

Adam"

Well, I'm here. Can anyone help?
thedude
I believe what you will need to access a MSSQL server from PHP is FreeTDS.

http://www.freetds.org/

I don't really know a whole lot about that software, as I've never had a need to connect PHP on a linux platform to a MSSQL server...but that just might do it for you.
TeddyReddy
Thanks a lot! I'm looking into it. I think that perhaps this is a problem with MySQL vs T-SQL, and if the local server was also running MySQL, it wouldn't be such a hassle?
thedude
Yes if your local server was running MySQL then this wouldn't be a problem at all...you would simply make sure the MySQL ports were open and you could connect remotely.

There are programs out there that will convert MSSQL to MySQL for you.

Heres another link for you to with an example.

http://www.linuxjournal.com/article/6636

Keep in mind TDS is getting a bit old...but hopefully it will get the job done for you.
TeddyReddy
Looks perfect. Now all I have to do is figure out how to use ODBCConfig in CPanel to set up the ODBC connection. I may be asking tech support for assistance there.

PS You have already made these message boards well worth it.
thedude
I wonder if this would work:

http://www.mysql.com/products/connector/odbc/

Allows you to connect a ODBC database to a MySQL database...wonder if that would work both ways. So that MySQL could connect to the ODBC(MSSQL) database and pull data from/to it.
TeddyReddy
Thanks!

Right now I've run into a problem, though, with FreeTDS. I'd like to try and get through it before I look at any other options.

My issue is that I can't tell if it supports MSSQL Server 2005!

If you check, there are some conflicting messages on the webpage:

1. it DOES support SQL Server 2005: http://lists.ibiblio.org/pipermail/freetds...6q1/019519.html (start from there and check the next couple of messages)
2. it DOESN'T support SQL Server 2005: http://www.freetds.org/userguide/choosingtdsprotocol.htm (not listed here)

Do you know anyone who's USED the program with SQL Server 2005?

I'm marshaling all my resources to answer this question. tongue.gif I continue to appreciate your wonderful assistance.
thedude
From what I can see, it will support 2005...but you need to use the .9 driver.

http://docs.moodle.org/en/Installing_MSSQL_for_PHP

QUOTE
Important Note 1: Due to one bug in PHP it's highly recommendable to use PHP > 5.1.6 with FreeTDS (more info).

Important Note 2: Due to one bug in how FreeTDS handles nulls and empty values for some text types it's highly recommendable to use a recent version of FreeTDS (0.64 + official patches) (more info).


Thats a website for installing some different application, but they do go through a nice step by step insall for FreeTDS.

And from what I can tell, they're configuring TDS to connect to MSSQL 2005.

As far as personal experience though, I've never used FreeTDS to connect to MSSQL 2005.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.