Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

MS SQL connect: exception after machine sleep/wakeup

worldexplorer's profile image worldexplorer posted 3 years ago in Creating a connection Permalink

Hi HeidiSQL team! I really appreciate your work, 5mb for a convenient SQL browser that's what we all need. I'm using Heidi SQL for ~3 years and I donated at some point; will do it again.

Heidi throws an exception, offering to continue/restart the application, after I

  1. made a connection to MS SQL;
  2. worked with it;
  3. hibernated / made the Windows 7 sleep;
  4. pushed POWER button to unhibernate / wake up;
  5. clicked on any table in Heidi to see it's content, or "run query" in a tab I left prior to sleep;

the exception shows up, and the healing method is

  1. disconnect from MS SQL
  2. or close HeidiSQL/ open again

Could you please fix this?

it's just looking at the exception at query execution, and if connection was already established by user but the TCP socket was closed by OS (that has just woke up / un-hibernated) - set up the same connection again and continue query execution.

I know HeidiSQL is written in Delphi; logically (C# pseudo-code) it would look like this:```

try {
  try {
    dbConnectionAbstraction.executeQuery_andFillDrid_withResultSet(query);
  } catch (Exception ex) {
    if (dbConnectionAbstraction.UserClickedLogIn and dbConnectionAbstraction.Connected = false) {
      try {
          dbConnectionAbstraction.Connect();
          dbConnectionAbstraction.executeQuery_andFillDrid_withResultSet(query);
      } catch (Exception ex2) {
        throw ex2;
      }
    }
    throw ex;
} catch (Exception ex3) {
  // show the dialog with continue/restart application
}

Thank you very much!

Pavel C

ansgar's profile image ansgar posted 3 years ago Permalink

Working around exceptions is not a good idea, I should fix that instead. So, I need the callstack of the exception, which you could post here as an attachment. You get the callstack along with some details about the crash, when you click "save to file" in the crash dialog.

worldexplorer's profile image worldexplorer posted 3 years ago Permalink

Hi Ansgar,

the callstack contains only one line; I'm pasting bugreport and attachind the screenshot

date/time : 2017-01-02, 13:11:17, 55ms

computer name : XXXXXXXXXXXXXX

user name : xxxxxxxxxxxx <admin>

registered owner : user

operating system : Windows 7 x64 Service Pack 1 build 7601

system language : English

system up time : 28 days 2 hours

program up time : 12 days 23 hours

processors : 8x Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz

physical memory : 9372/16289 MB (free/total)

free disk space : (C:) 105.34 GB

display mode : 2560x1600, 32 bit

process id : $445c

allocated memory : 349.69 MB

largest free block : 8185.16 GB

executable : heidisql.exe

exec. date/time : 2016-12-16 12:43

version : 9.4.0.5142

compiled with : Delphi XE5

madExcept version : 4.0.12

callstack crc : $2ef15873, $2ef15873, $2ef15873

exception number : 4

exception class : Unknown

exception message : Unknown.

main thread ($6e1c):

00a9467a heidisql.exe dbconnection 2471 +47 TAdoDBConnection.Query

2 attachment(s):

Please login to leave a reply, or register at first.