note 81149 added to ref.mssql
| From: | jigarbe at yahoo dot com | Date: | Fri, 15 Feb 2008 16:32:30 +0000 |
| Subject: | note 81149 added to ref.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136181@lists.php.net to get a copy of this message | ||
PHP and SQL Server
Install And Configure FreeTDS
The first thing you need to do is to download and install the FreeTDS driver. You can get the source
and compile it yourself from http://www.freetds.org/, but I
prefer RPMs. Depending on your distrobution of Linux, the version you want will vary. I'm
running Red Hat Enterprise Linux 4 ES and CentOS 4, which are both almost identical. I installed
freetds-0.62.3-1 from http://rpmforge.net/user/packages/freetds/
After installing FreeTDS, you can check your driver by attempting to connect to the MSSQL Server. Of
course, use the appropriate server name, username and password in your command line.
# /usr/bin/tsql -S [mssql.servername.or.ip] -U [ValidUser]
locale is "en-US.UTF-8"
locale charset is "UTF-8"
Password: [password]
1>
Enter "quit" to exit your successful connection. If the tsql command doesn't return
the 1> prompt, verify that you can get to your MSSQL server with telnet [mssql.servername.or.ip]
1433 and that your username and password are valid.
Next, edit your /etc/freetds.conf configuration file and add the following at the end of the file:
[TDS]
host = [mssql.servername.or.ip]
port = 1433
tds version = 7.0
Setup ODBC Data Source
Next, unixODBC needs to know about all ODBC drivers you intend to use. While you can use the GUI
program that comes with unixODBC, you can also use the odbcinst command. First create a template
file containing your FreeTDS setup information.
tdsdriver.template
[FreeTDS]
Description = v.062 with protocol v7.0
Driver = /usr/lib/libtdsodbc.so.0
Run odbcinst, telling it to install a driver entry using the template we just created.
# odbcinst -i -d -f tdsdriver.template
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc
This will add an entry to the end of the file /etc/odbcinst.ini
[FreeTDS]
Description = v0.62 with protocol v7.0
Driver = /usr/lib/libtdsodbc.so.0
UsageCount = 1
----
Server IP: 203.199.69.133
Probable Submitter: 60.243.21.196
----
Manual Page -- http://www.php.net/manual/en/ref.mssql.php
Edit -- https://master.php.net/note/edit/81149
Del: integrated -- https://master.php.net/note/delete/81149/integrated
Del: useless -- https://master.php.net/note/delete/81149/useless
Del: bad code -- https://master.php.net/note/delete/81149/bad+code
Del: spam -- https://master.php.net/note/delete/81149/spam
Del: non-english -- https://master.php.net/note/delete/81149/non-english
Del: in docs -- https://master.php.net/note/delete/81149/in+docs
Del: other reasons-- https://master.php.net/note/delete/81149
Reject -- https://master.php.net/note/reject/81149
Search -- https://master.php.net/manage/user-notes.php