-- 1 query timeout
SelectCommentid, generalid, nodeid, topicid, commenttitleFrom OpenDataSource(
'Sqloledb',
'Data Source = 111.68.9.50; user id = sq_zhqlzzf; Password = 123456'
). Sq_zhqlzzf.dbo.pe_comment
/*
The ole db access interface "sqlncli" of the linked server "(null)" returns the message "Logon timeout expired ".
An error occurred while connecting to the ole db access interface "sqlncli" of the "(null)" server "to return the message" Establishing a connection to the server. When you connect to SQL Server 2005, the fact that SQL server does not allow remote connection by default may cause failure. ".
Message 53, level 16, status 1, 0th rows
Named Pipe provisionProgram: Unable to open connection with SQL Server [53].
*/
In this case, the timeout parameter should be added, and timeout = 0 will wait indefinitely, so that even if the server fails to write an error or other issues, it will always wait. Therefore, we do not recommend that you use timeout = 0.
SelectCommentid, generalid, nodeid, topicid, commenttitleFrom OpenDataSource(
'Sqloledb',
'Data Source = 111.68.9.50; user id = sq_zhqlzzf; Password = 123456; timeout = 180'
). Sq_zhqlzzf.dbo.pe_comment
/*
Commentid generalid nodeid topicid commenttitle
-----------------------------------------------------------
1 75 7 1 OK
2 75 7 1 fill
3 75 7 1
4 77 7 1 faster
5 77 7 1 ASDF
6 99 7 1 ASDFASDF
7 99 7 1 ASDFASDF
(7 rows affected)
*/