在数据库添加本机IP。

在数据库添加本机IP。,第1张

create table #ip(id int identity(1,1),re varchar(200))

declare @s varchar(1000)

set @s='ping '+host_name()+' -a -n 1 -l 1'

insert #ip(re) exec master..xp_cmdshell @s

select 连接的计算机名=host_name(),RE

IP地址=stuff(left(re,charindex(']',re)-1),1,charindex('[',re),'')

from #ip

where id=2

drop table #ip

服务器地址可以是:localhost 、127.0.0.1、服务器ip地址;

默认填写localhost

数据库地址就是要调用的数据库的服务器ip

服务器和站点在相同服务器上可以使用第一点说的三种方式

服务器和站点不在相同ip上就需要输入数据库的外网ip地址。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/10076339.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存