dpstir0081 2013-06-13 11:10
浏览 72

通过ODBC错误连接到MSSQL数据库

Where to start..

  • I have a server with windows 2008 R2 standard 32 bits.
  • On that server ISS 7 is installed and a php site is added but requires databases.
  • Made an sql database on that server wich is called 'test'.
  • ODBC connection is made and tested and it succeeded.
  • Now when I use this php code to connect to the server it gives me:

    Can not connect because the target machine actively refused it.

php code:

<?
### Database    ###
$user = "*****"; //database user
$pass = "*****";    //database password
$host = "localhost";   //database location
$db = "test";     //database name
##mysql_connect ("$host","$user","$pass");
##mysql_select_db("$db");
$dbConn = odbc_connect("$db","$user","$pass","$host") or die(odbc_errormsg());
?>

The password and username are correct but the error still remains.

Any help is appreciated!

  • 写回答

1条回答 默认 最新

  • duannai1883 2013-06-13 11:48
    关注

    Have you set your datasource using administrative tools, data sources, System DSN?

    if not i'm sure it won't find the database.

    see this link: http://support.microsoft.com/kb/305599

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用