My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 173: Not clear error when conection lost
1 person starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  May 2011


 
Reported by filosde...@gmail.com, Apr 28, 2011
What steps will reproduce the problem?
1. connect to db ( client machine to server )
2. crash server/db or unplug client/server from the web
3. try a query

What is the expected output? What do you see instead?
  A clear connection error

What version of the product are you using? On what operating system?
  pyodbc-2.1.8-py2.6

Please provide any additional information below.

it can be solved if add this code inside pyodbc:

try:
  doQuery( strquery, args )
except:
  try:
    #dummy query to check connection
    doQuery( 'select 1 as [a]', args )
    raise original error
  except:
    raise connection error

if dummy query fail it must be connection error


May 20, 2011
Project Member #1 mkleehammer
I don't this is something I can do, considering some potential side effects.

You may consider examining the SQLSTATE that is part of the original error to see if it is consistent.  Your database give you a consistent error for this condition.  (What database are you using and what error do you get?)

However, it would be very easy for you to wrap the cursor class and do exactly what you show here.  The easiest way to is to create a new class that holds a native cursor and passes all _getattr_ calls to it except for execute.  If you need an example, let me know.  Perhaps I should add a wiki page for this.

Status: WontFix

Powered by Google Project Hosting