数据库连接的问题

weidegong 2004-12-22 11:29:37
我是在Delphi里通过连接字符串进行连接的,但是:
在许多机器上(主要是2000,98),必须先用\\机器名登陆一下对方,才可以通;这非常不方便,请问大家如何解决这个问题的;


用ODBC建立数据源来连接的时候,就没有此问题(安装了10余台,都没问题)
...全文
556 30 打赏 收藏 转发到动态 举报
写回复
用AI写文章
30 条回复
切换为时间正序
请发表友善的回复…
发表回复
weidegong 2004-12-29
  • 打赏
  • 举报
回复
上边敲错了:(


ADO的连接字符串相关参数还有:

Network Address,指定IP地址和SQLServer的端口号,1433可以不写
Trusted_Connection,是否使用信任连接
……

具体查看MSDN或SQLServer2000的联机帮助
weidegong 2004-12-29
  • 打赏
  • 举报
回复
ODBC相关参数还有:

Network Address,指定IP地址和SQLServer的端口号,1433可以不写
Trusted_Connection,是否使用信任连接
……

具体查看MSDN或SQLServer2000的联机帮助
weidegong 2004-12-28
  • 打赏
  • 举报
回复
此问题终于解决,只要在连接字符串中添加Network Library=dbmssocn,指定使用TCP/IP协议连接即可。

参考MSDN:http://support.microsoft.com/kb/238949/en-us

MORE INFORMATION
SQL Server allows you to use the following network libraries when establishing a connection. They are:
• dbnmpntw - Win32 Named Pipes
• dbmssocn - Win32 Winsock TCP/IP
• dbmsspxn - Win32 SPX/IPX
• dbmsvinn - Win32 Banyan Vines
• dbmsrpcn - Win32 Multi-Protocol (Windows RPC)
When connecting to SQL Server through ADO the NETWORK parameter in the connection string can be used to specify which of these libraries to use when connecting to the database. The NETWORK parameter is the name of the Net-Library module to use, without the .dll suffix (for example, Dbmssocn, not Dbmssocn.dll). Here are some examples of connection strings that specify this parameter:

Note Make sure that User ID has the appropriate permissions to perform this operation on the database. • The following connection string:

"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=<User ID>;Initial Catalog=pubs;Data Source=<YourDataSourceName>;Network Library=dbnmpntw"

tries to connect to SQL Server through the SQLOLEDB provider using the Named Pipes network library.
• The following connection string:

"Provider=MSDASQL.1;Persist Security Info=False;User ID=<User ID>;Extended Properties="DSN=<yourdatasourcename>;UID=<User ID>;DATABASE=pubs;Network Library=dbmssocn";Initial Catalog=pubs"

connects to SQL Server through the MSDASQL provider using the TCP/IP network library.
bmwyc 2004-12-25
  • 打赏
  • 举报
回复
不过建议不要用ODBC连,速度稍慢!
y740504 2004-12-25
  • 打赏
  • 举报
回复
不会呀,我就用这样的方式进行的呀,将所以数据的连接字符串保存到INI文件中的,用混合登录模式。你再试试将:mdac升级成2.8版的。我在98中连接不成功,但只要升级成2.8版就OK了

todouwang 2004-12-25
  • 打赏
  • 举报
回复
看下用户权限
slhuang 2004-12-24
  • 打赏
  • 举报
回复
偶也遇到过这种问题。具体原因不清楚。听课。
weidegong 2004-12-24
  • 打赏
  • 举报
回复
To tzsxt(人在天涯) :
谢谢关注。
已经写了很多程序,这个恐怕是不能改了;你说的第三方控件,不怎么熟悉。我倒是想过换成SQL Direct v4.12 for Delphi/BCB,以支持多数据库。毕竟ADO好像只支持常用的数据库,象MySQL、Postgresql都不支持的
tzsxt 2004-12-24
  • 打赏
  • 举报
回复
数据库服务器是否开放匿名访问了啊
我访问数据库用的第三方控件SDAC 很方便啊 推荐使用
zzlazio 2004-12-24
  • 打赏
  • 举报
回复
应该是WINDOWS安全机制的问题..而且我怀疑需要先登陆的一般是WIN2000系统.
比如你要访问局域网内其他用户.都是先//计算机名 ..
碰到XP的一般可以直接登陆.而碰到WIN2000则有个登陆框..
你的程序应该是同样原理..
turbozzh 2004-12-24
  • 打赏
  • 举报
回复
我的SQL 服务器端删除命名管道方式,只用TCP/IP,没有这样的问题,跨网段也可以.
weidegong 2004-12-24
  • 打赏
  • 举报
回复
^
WYC2300 2004-12-23
  • 打赏
  • 举报
回复
楼主是本地的系统么`~~~~
我用的IP来连接的````
不懂你是用什么的```
不过我这样结合DELPHI也是要在INI文件里面改动响应的连接信息`````
我不懂怎么在DELPHI在获取SQL的IP及其他的相关信息也就是把这些信息先读入INI文件望楼下的兄弟可以指点下````
didoleo 2004-12-23
  • 打赏
  • 举报
回复
是不是域名解析问题呢?(猜测)
weidegong 2004-12-23
  • 打赏
  • 举报
回复
连接字符串如下,应该没有问题。
Provider=SQLOLEDB.1;Password=spc;Persist Security Info=True;User ID=spc;Initial Catalog=Coding;Data Source=server

我装了SQLServer Enterprise和开发版,其中身份验证都是“SQL Server 和Windows”


To zjcxc(邹建) :我的开发版已经装了sp3,但是别人好像还得先\\MyIP,这么访问一下才可以。

正在测试其他计算机
fangzhouyu 2004-12-23
  • 打赏
  • 举报
回复
jh
herman~~ 2004-12-23
  • 打赏
  • 举报
回复
没遇到过这种情况。
JonnySun 2004-12-23
  • 打赏
  • 举报
回复
關注中....
zjx668 2004-12-23
  • 打赏
  • 举报
回复
请问一下怎么在这个论坛上提出问题?谢谢
weidegong 2004-12-23
  • 打赏
  • 举报
回复
To JonnySun():
由于安全性方面的问题,不允许这么做:(
加载更多回复(10)

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧