ServerName:=IniFile ReadString (' Option ', 'DbServer', 'computer');//here is the IP address of the ali cloud
DbName:=IniFile ReadString (' Option ', 'DbName', 'database');
The DbSa:=IniFile ReadString (' Option ', 'the DbA,' SA ');
Dbpwd:=IniFile ReadString (' Option ', 'DbPw', "password");
ADOConnection1. The ConnectionString:='Provider=SQLOLEDB. 1; Password='+ Dbpwd +'; Persist Security Info=True; User ID='+ DbSa +'; Initial Catalog='+ DbName +'; Data Source='+ +' ServerName ';
CodePudding user response:
The way the code should be correct, please check the server firewall have open data service ports for the network access,Can I refer to this article https://blog.csdn.net/tanqth/article/details/109267595 check,
Simple said:
Check the data configuration can you not be able to connect to the local data services, to connect to a remote actually just change IP;
Second check if you have access to the remote server, PING the server IP will know; Can't check the network, routing, firewall
Then check that the server port can access Telnet IP port; Can't check the firewall, database services configuration
The above three examined, basic can connect,