同样的连接字符串,其它的windows程序都能访问,就是windows服务不能访问;
"Data Source=192.168.0.1;Initial Catalog=tBase;Persist Security Info=True;User ID=sa;Password=123"
若改为127.0.0.1 就没有问题

解决方案 »

  1.   

    我用的是sqlserver2005,2005的sp3都还没有出来
      

  2.   

    Data Source换成服务器名试下,可能是域名解析有问题
      

  3.   

    首先确定 192.168.0.1 上的SQL  是没有问题的!然后 看看服务管理器 是否开打!然后看看是不是SQL的设置!是不是有问题!
       最好你能把错误写出来! 
      

  4.   

    帐号的问题吧 System帐号虽然在本地可以为所欲为, 但是, 远程有限制的
      

  5.   

    各位大侠,有没有人用windows 服务访问过远程数据库??
      

  6.   

    <add key="ss" value="server=192.168.0.1;uid=sa;pwd=;database=123" />
      

  7.   

    The LocalSystem account is a predefined local account used by the service control manager. This account is not recognized by the security subsystem. It has extensive privileges on the local computer, and acts as the computer on the network.Windows NT:  The service has limited access to network resources, such as shares and pipes, because it has no credentials and must connect using a null session
      

  8.   

    我之前也碰到这样的问题,原因可能有以下几个
    1. sql server的版本问题,如果你是连接express版本,就必须Data Source=192.168.0.1\sqlexpress2. server设置问题,必须把远程访问打开    1. 确保服务器端的数据库中存在,并支持混合登录模式.默认安装的时候,可能会忽略建立.    2. 确保服务器端的数据库是支持远程调用的.打开SQL Server Management Studio,选择该数据库,右键菜单"Properties",在打开的对话框中选择Connections,把Allow remote connections to this server选上.    3. 确保服务器端的SQL服务的TCP/IP是Enable的.打开SQL Server Configuration Manager. 选择SQL Server 2005 Network Configuration下的Protocols for SQL2005( 我安装的SQL示例名为SQL2005), 把Named Pipes和TCP/IP都修改为Enabled,默认是Disabled.        4. 确保服务器端的SQL实例的远程调用是支持TIP/IP和named pipes的. 打开SQL Server Surface Area Configuration Manager,在打开的页面中选择Surface Area Configuration for Services and Connections.选中实例的Remote Connections,把Using both TCP/IP and named pipes选中.        5. 重启服务器端的SQL Server 2005服务,确保SQL Server Agent和SQL Server Browser的服务也启动了. 默认都是需要手动启动,可以改成Automatic.   3. 如果server设置也ok,如果还不能连,就是被Windows自带的firewall挡住了,
        在Windows防火墙中的Exceptions中Add Port:TCP 1433和UDP 1434, 同时还需要Add Program.先打开SQL Server Configuration Manager,在 SQL Server 2005 Services中选中SQL Server,查看属性,在Advanced中记下Instance ID.如(MSSQL.1)
      

  9.   

     这个设置一个odbc数据源,访问这个数据源行了吧
     
      

  10.   

    sql server 2005
    ->配置工具
    ->SQL Server 外围应用配置器
    ->SQL Server Configuration Manager
    ->启用TCP/IP协议
      

  11.   

    我也遇到过,当时是sql server 2000,我下个升级包一装,全部OK!
    sql server 要升级成SP4才行.
    2005也解决不了问题.