It works well. When I query SQL Server Linked server sends connect <g class="gr_ gr_15 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="15" id="15"><g class="gr_ gr_18 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="18" id="18">odbc</g></g> call and executes the queries.
If I wait for 1 minutes with no activity the connection is closed automatically.
Is there a way to Disconnect Linked Server connection - Not delete and re-add. I would like to do similar to what we do in any programming language i.e
<g class="gr_ gr_16 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="16" id="16">cn</g>.Disconnect() - To send the disconnect command to the DNS data so
I don't think so
You can allow/disallow data access with something like
EXEC sp_serveroption @server
= 'SWLON1'
,@optname =
'data access'
,@optvalue =
'FALSE'
But doing this would mean that other connections cannot use the Linked Server.
ODBC connections are outside of the SQL Server environment and as such this question needs to be raised in the appropriate OS forum.
However from what I know of ODBC this still cannot be done; perhaps if you could explain what you are trying to achieve we could make some other suggestions? Is the ODBC connection(s) local to end user workstations or on a shared device?
HI,
>>ODBC connections are outside of the SQL Server environment and as such this question needs to be raised in the appropriate OS forum
Raj: I think SQL Server is the appropriate forum because I am using Linked Server on SQL Server and looking for a feature to send Disconnect command to the linked Server.
Normally on when using programming language it would be something like.
cn.Close or <g class="gr_ gr_117 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="117" id="117">cn</g>.Disconnect ( <g class="gr_ gr_141 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="141" id="141">cn</g> is connection object)
If I execute a query on linked server and perform no activity for 1 minute SQL Server automatically sends Disconnect command to ODBC driver.
>>if you could explain what you are trying to achieve we could make some other suggestions
Raj: I noticed SQL Server is sending disconnected command every 4-5 minutes when running stored procedure.
When Disconnect command is sent ODBC driver closes the session and the records which are not committed are lost.
So I would like to Disconnect it manually before 5 minutes and reconnect it so that I do not lose any transaction.
ODBC Driver is installed on the local, same as the SQL Server is installed.