All Forums Connectivity
martin.lawless 4 posts Joined 07/11
03 Jul 2012
Terminating ODBC Connections using other programming languages such as Python

Hello!

A problem that I have been coming across is that when I connect to Teradata via a third-party programming language (whether that be Python or C), the Teradata session does not terminate until the system times out even though I explicitly close the ODBC connection.  The following is an excerpt from my code:

import pyodbc
conn = pyodbc.connect(DSN='myDSN',uid='myUsername',pwd=' myPassword')
cursor = conn.cursor()
...
...
cursor.close()
conn.close()

Teradata does not seem to recognize the "close()" attribute even though Python does (same thing happens in C).  With programs that are set to run every 5 minutes (a shorter time period than the timeout period), the virtual connections quickly become all used up.

Is there a command that I am missing or has this something to do with Teradata?  I appreciate all the help you can give.

Sincerely,
Martin

Elle 16 posts Joined 11/07
30 Jan 2013

Hello,
 
We are experiencing the same problem as well.  Have you had any progress in resolving the issue?  Did you open an Incident?
 
Thanks,
 
Linda

vhari 111 posts Joined 12/08
04 Feb 2013

Please check if connection pooling is turned on.  If pooling is turned on, the ODBC Driver Manager will not call ODBC driver to close the connection, until a pool timeout happens.
Please check the "pooling" variable described in this pyhton wiki link.  https://code.google.com/p/pyodbc/wiki/Module

You must sign in to leave a comment.