Home  >  Article  >  Backend Development  >  在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium_PHP教程

在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium_PHP教程

WBOY
WBOYOriginal
2016-07-12 09:03:571103browse

在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium

    可以用在Sybase的db-lib或者ct-lib库,在里面也包含了一个ODBC的库。允许许多应用软件连接到Sybase或者微软的SQL服务器;

在windows下使用FreeTDS

    什么是FreeTDS? FreeTDS其实就是一个开源(或者可以说成自由)的C程序库,它可以实现在Linux系统下访问操作微软的SQL数据库。FreeTDS是以源码的现实发布的,正因为是这样,所以它几乎可以在任何系统中进行编译安装。

如果你的服务器是Windows系统, 那么你应该使用 php_dblib.dll。(more information on Using FreeTDS for Unix.)

1:按照下面的链接来下载 php_dblib.dll 并且将其保存到 /PHP/ext 文件夹下面.

https://docs.moodle.org/30/en/Installing_MSSQL_for_PHP#Using_the_SQL_Server_2005_Driver_for_PHP_from_Microsoft_on_Windows

2、在php配置文件 /PHP/php.ini 中添加:

extension=php_dblib.dll    重启apache

3:测试:

1    <?<span>php
</span>2        <span>$link</span> = mssql_connect('localhost', 'db_user', 'db_password'<span>);
</span>3        <span>if</span>(!<span>$link</span><span>) {
</span>4            <span>echo</span>'Could not connect'<span>;
</span>5            <span>die</span>('Could not connect: ' .<span> mssql_error());
</span>6<span>        }
</span>7        <span>echo</span>'Successful connection'<span>;
</span>8        mssql_close(<span>$link</span><span>);
</span>9    ?>

ok,成功!!!

 

参考:http://www.th7.cn/Program/php/201303/129462.shtml

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1077131.htmlTechArticle在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium 可以用在Sybase的db-lib或者ct-lib库,在里面也包含了一个...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn