Forum Discussion
ODBC from Access to SQL Server database - query timeout expired
- George_HepworthOct 23, 2023Silver Contributor
I don't recall. Did you ask the DBA for this SQL Server for assistance? In fact, we ought to be clear on where this SQL Server is located, local or remotely hosted.
One other thing comes to mind, which I probably should have thought of previously. Depending on where this SQL Server is, local or hosted, it may be that you have to specify that the connection needs to trust the Server Certificate to which it's connecting.
Note the elements of this connection string for a table linked in Access, for example, especially the last one.
DRIVER=ODBC Driver 18 for SQL Server; SERVER=YourServerNameGoesHere;UID=YourUserIDGoesHere;PWD=YourPasswordGoesHere;Trusted_Connection=No;APP=LocalApplicationName;DATABASE=YourSSDatabaseNameGoesHere;Encrypt=Yes;TrustServerCertificate=Yes;
TrustServerCertificate is being required by more hosts, as well as by SQL Azure. I have been caught out by it at least a couple of times in the last 6 months.
- danevaldOct 24, 2023Copper ContributorFound a solution now, the querytimeout had to be extended a lot...
I did not work to change the setting in Access, Options, Client settings, OLE/DDE timeout, I had to do it in registry:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\Office\16.0\Access Connectivity Engine\Engines\ODBC\QueryTimeout
I only have access to 1 table, but still it takes at least 1½-3 minutes to open the connection. I'm told because of the number of tables this might be as expected.- Tom_van_StiphoutOct 24, 2023Steel ContributorI have opened an Access FE with ODBC links to a few dozen tables among 4000 (!) tables in the on-prem SQL Server BE, and it was instantaneous.
The timeout can also be set on the QueryDef object, if you're running a PT query.