Terminating ODBC Connections using other programming languages such as Python

Connectivity

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

2 REPLIES
N/A

Re: Terminating ODBC Connections using other programming languages such as Python

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

Teradata Employee

Re: Terminating ODBC Connections using other programming languages such as Python

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