I just started trying the connection pooling and got this error when I
was trying to see how good it can detect garbage collection. This is
the sequence of operations I performed via iPython (on sql server via
pyodbc):

--------------------------------------------------------------------------------
import sqlalchemy.pool
import pyodbc
pyodbc = sqlalchemy.pool.manage(pyodbc, pool_size=1, max_overflow=1)
dbstring = 'DRIVER={SQL Native Client};SERVER=%s,%s;DATABASE=%s;UID=
%s;PWD=%s'
c = pyodbc.connect(dbstring % ("localhost", 1433, "master",
"username", "password"))
c = None
import db
import gc
gc.collect()
c = pyodbc.connect(dbstring % ("localhost", 1433, "master",
"username", "password"))
c2 = pyodbc.connect(dbstring % ("localhost", 1433, "master",
"username", "password"))
c = None
c2 = None
gc.collect()
c = pyodbc.connect(dbstring % ("localhost", 1433, "master",
"username", "password"))
c2 = pyodbc.connect(dbstring % ("localhost", 1433, "master",
"username", "password"))
--------------------------------------------------------------------------------

After the last statement,  I got the below error:

--------------------------------------------------------------------------------
C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in connect
(self, *args, **params)
    907         """
    908
--> 909         return self.get_pool(*args, **params).connect()
    910
    911     def dispose(self, *args, **params):

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in connect
(self)
    140     def connect(self):
    141         if not self._use_threadlocal:
--> 142             return _ConnectionFairy(self).checkout()
    143
    144         try:

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in __init__
(self, pool)
    302         self.__counter = 0
    303         try:
--> 304             rec = self._connection_record = pool.get()
    305             conn = self.connection =
self._connection_record.get_connection()
    306             self._connection_record.backref = weakref.ref
(self, lambda ref:_finalize_fairy(conn, rec, pool, ref))

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in get(self)
    159
    160     def get(self):
--> 161         return self.do_get()
    162
    163     def do_get(self):

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in do_get(self)
    637
    638             try:
--> 639                 con = self.create_connection()
    640                 self._overflow += 1
    641             finally:

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in
create_connection(self)
    120
    121     def create_connection(self):
--> 122         return _ConnectionRecord(self)
    123
    124     def recreate(self):

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in __init__
(self, pool)
    196     def __init__(self, pool):
    197         self.__pool = pool
--> 198         self.connection = self.__connect()
    199         self.info = {}
    200         if pool._on_connect:

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in __connect
(self)
    259         try:
    260             self.starttime = time.time()
--> 261             connection = self.__pool._creator()
    262             if self.__pool._should_log_info:
    263                 self.__pool.log("Created new connection %r" %
connection)

C:\apps\Python24\lib\site-packages\sqlalchemy\pool.pyc in <lambda>()
    886             try:
    887                 if key not in self.pools:
--> 888                     pool = self.poolclass(lambda:
self.module.connect(*args, **params), **self.params)
    889                     self.pools[key] = pool
    890                     return pool

Error: ('IM006', "[IM006] [Microsoft][ODBC Driver Manager] Driver's
SQLSetConnectAttr failed (0); [01000] [Microsoft][SQL Native Client]
[SQL Server]Changed database context to 'dsmaster'. (5701); [01000]
[Microsoft][SQL Native Client][SQL Server]Changed language setting to
us_english. (5703)")
--------------------------------------------------------------------------------

Is this a known problem with the pool or something is wrong with the
usage? Thank you.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to