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

在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

 

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools