My favorites | Sign in
Project Logo
             
Details: Show all Hide all

Last 7 days

  • Dec 22, 2009
    issue 79 (SPROC does not return results.) commented on by todd.w.sullivan   -   I am unable to duplicate this with Python 2.6, SQLServer 2005. Just tested and I was able to run a stored procedure. Can you please try the following: import pyodbc cstring='DRIVER={SQL Server};SERVER=myserver;DATABASE=mydb' sqlcmd='exec sp_help \'sys.tables\'' conn=pyodbc.connect(cstring,) csr=cn.cursor() print "SQL is", sqlcmd exec sp_help 'sys.tables' csr.execute(sqlcmd) recs=csr.fetchall() print recs It should give output similar to: [(u'tables', u'sys', u'view', datetime.datetime(2007, 2, 10, 0, 23, 16, 57000))]
    I am unable to duplicate this with Python 2.6, SQLServer 2005. Just tested and I was able to run a stored procedure. Can you please try the following: import pyodbc cstring='DRIVER={SQL Server};SERVER=myserver;DATABASE=mydb' sqlcmd='exec sp_help \'sys.tables\'' conn=pyodbc.connect(cstring,) csr=cn.cursor() print "SQL is", sqlcmd exec sp_help 'sys.tables' csr.execute(sqlcmd) recs=csr.fetchall() print recs It should give output similar to: [(u'tables', u'sys', u'view', datetime.datetime(2007, 2, 10, 0, 23, 16, 57000))]
  • Dec 22, 2009
    issue 82 (when using contextlib wrapper, cursor.execute fails when cur...) commented on by ivan.melnychuk   -   RE: bug > great, thanks RE: parameters > I know and it is cool, but it is not part of DB-API so I try not to use it for (appearance of) portability.
    RE: bug > great, thanks RE: parameters > I know and it is cool, but it is not part of DB-API so I try not to use it for (appearance of) portability.
  • Dec 22, 2009
    issue 82 (when using contextlib wrapper, cursor.execute fails when cur...) changed by mkleehammer   -   There is definitely a bug and I will fix it, but I can also provide a work around. The crash only occurs when you are creating multiple cursors, which you are doing by putting the cursor() call inside the loop. When I take it out of the loop (and change "(1,)" to "(row,"), the crash does not occur: def test2(self): logger = logging.getLogger('test_with_fails') with pyodbc_connect(self._db_conn_str) as db_conn: curs = db_conn.cursor() for row in range(2): logger.info("Inserting row %d ...", row) curs.execute(Test_pyodbc_connect._SQL_INSERT, (row,)) logger.info("Inserted row %d ...", row) return True As an FYI, you can pass parameters without putting them into a tuple if you want: curs.execute("insert ...", (1,)) --> curs.execute("insert ...", 1)
    Status: Investigating
    Labels: Priority-High Priority-Medium
    There is definitely a bug and I will fix it, but I can also provide a work around. The crash only occurs when you are creating multiple cursors, which you are doing by putting the cursor() call inside the loop. When I take it out of the loop (and change "(1,)" to "(row,"), the crash does not occur: def test2(self): logger = logging.getLogger('test_with_fails') with pyodbc_connect(self._db_conn_str) as db_conn: curs = db_conn.cursor() for row in range(2): logger.info("Inserting row %d ...", row) curs.execute(Test_pyodbc_connect._SQL_INSERT, (row,)) logger.info("Inserted row %d ...", row) return True As an FYI, you can pass parameters without putting them into a tuple if you want: curs.execute("insert ...", (1,)) --> curs.execute("insert ...", 1)
    Status: Investigating
    Labels: Priority-High Priority-Medium
  • Dec 22, 2009
    issue 81 (exception when inserting more than 400KB in column) Status changed by mkleehammer   -   Some good news. I've found your test works with SQL Server 2008 using native client 10.0: DRIVER={SQL Server Native Client 10.0} The problem is we don't yet know if the fix is in (1) SQL Server 2008 or (2) Native Client 10.0. We do know Native Client 10 can connect to SQL 2005, and I'm pretty sure you can download the client portion for free. Since I don't have 2005 handy at home, can you test the Native Client 10 with 2005 if you can find a download? In the meantime, I'll keep looking.
    Status: Investigating
    Some good news. I've found your test works with SQL Server 2008 using native client 10.0: DRIVER={SQL Server Native Client 10.0} The problem is we don't yet know if the fix is in (1) SQL Server 2008 or (2) Native Client 10.0. We do know Native Client 10 can connect to SQL 2005, and I'm pretty sure you can download the client portion for free. Since I don't have 2005 handy at home, can you test the Native Client 10 with 2005 if you can find a download? In the meantime, I'll keep looking.
    Status: Investigating
  • Dec 21, 2009
    issue 82 (when using contextlib wrapper, cursor.execute fails when cur...) commented on by ivan.melnychuk   -   Another finding. > It only fails when the insert statement is executed with the parameter. If no parameters are passed to cursor.execute(). Therefore following works as expected: def test_with_works_noparam(self): """ Use contextmanager and immediatelly execute sql on cursor. """ logger = logging.getLogger('test_with_works_noparam') with pyodbc_connect(self._db_conn_str) as db_conn: for row in range(2): logger.info("Inserting row %d ...", row) curs = db_conn.cursor() curs.execute("INSERT INTO test_pyodbc_table (SomeUniqueValue) VALUES (1)") logger.info("Inserted row %d ...", row) return True
    Another finding. > It only fails when the insert statement is executed with the parameter. If no parameters are passed to cursor.execute(). Therefore following works as expected: def test_with_works_noparam(self): """ Use contextmanager and immediatelly execute sql on cursor. """ logger = logging.getLogger('test_with_works_noparam') with pyodbc_connect(self._db_conn_str) as db_conn: for row in range(2): logger.info("Inserting row %d ...", row) curs = db_conn.cursor() curs.execute("INSERT INTO test_pyodbc_table (SomeUniqueValue) VALUES (1)") logger.info("Inserted row %d ...", row) return True
  • Dec 21, 2009
    issue 82 (when using contextlib wrapper, cursor.execute fails when cur...) reported by ivan.melnychuk   -   What steps will reproduce the problem? > run the attached script What is the expected output? What do you see instead? > expect to see the output as documented in attached module. Actually the output is as expected, but an unhandled win32 error is thrown as well, which kills the process. What version of the product are you using? On what operating system? > python 2.6.4 on WinXP-SP2, pyodbc-2.1.6 Please provide any additional information below. > Basically I have a little context-aware wrapper around pyodbc.connect so that it can be used with with_statement as described at http://docs.python.org/library/contextlib.html. The problem using it does not work in a very strange situation where the difference between works/does-not-work is narrowed down to the difference between following lines: 1-works: ... db_conn.cursor().execute(Test_pyodbc_connect._SQL_INSERT, (1,)) ... 2-does not work: ... curs = db_conn.cursor() curs.execute(Test_pyodbc_connect._SQL_INSERT, (1,)) ...
    What steps will reproduce the problem? > run the attached script What is the expected output? What do you see instead? > expect to see the output as documented in attached module. Actually the output is as expected, but an unhandled win32 error is thrown as well, which kills the process. What version of the product are you using? On what operating system? > python 2.6.4 on WinXP-SP2, pyodbc-2.1.6 Please provide any additional information below. > Basically I have a little context-aware wrapper around pyodbc.connect so that it can be used with with_statement as described at http://docs.python.org/library/contextlib.html. The problem using it does not work in a very strange situation where the difference between works/does-not-work is narrowed down to the difference between following lines: 1-works: ... db_conn.cursor().execute(Test_pyodbc_connect._SQL_INSERT, (1,)) ... 2-does not work: ... curs = db_conn.cursor() curs.execute(Test_pyodbc_connect._SQL_INSERT, (1,)) ...

Last 30 days

  • Dec 15, 2009
    issue 81 (exception when inserting more than 400KB in column) reported by alexandr...@logilab.Fr   -   What steps will reproduce the problem? I'm using the latest release of pyodbc to connect to SQLServer 2005. I have attached a test case, which basically does the following 1. create 2 tables the first with a column of type varbinary(max) the other with a column of type varchar(max). 2. insert data of increasing size (400kB-10 to 400kB+10) What is the expected output? What do you see instead? The tests should pass, however they fail with a data size of 400kB, with an exception message: HY000 / The driver did not supply a message. What version of the product are you using? On what operating system? pyodbc 2.1.6 on python 2.5, running on Windows 2003 SP2. Connecting to SQLServer 2005 using the SQL Native Client driver (version 9.00.4035.00) Please provide any additional information below. I'm not an ODBC expert. The research I've made on MSDN indicates that the 400k barrier is well known with ODBC, and that there is something called Data-at-Execution which is supposed to be used to deal with it. I'm not yet sure how this works, but I'll dig further into this. Many thanks for sharing pyodbc with the community. Alexandre
    What steps will reproduce the problem? I'm using the latest release of pyodbc to connect to SQLServer 2005. I have attached a test case, which basically does the following 1. create 2 tables the first with a column of type varbinary(max) the other with a column of type varchar(max). 2. insert data of increasing size (400kB-10 to 400kB+10) What is the expected output? What do you see instead? The tests should pass, however they fail with a data size of 400kB, with an exception message: HY000 / The driver did not supply a message. What version of the product are you using? On what operating system? pyodbc 2.1.6 on python 2.5, running on Windows 2003 SP2. Connecting to SQLServer 2005 using the SQL Native Client driver (version 9.00.4035.00) Please provide any additional information below. I'm not an ODBC expert. The research I've made on MSDN indicates that the 400k barrier is well known with ODBC, and that there is something called Data-at-Execution which is supposed to be used to deal with it. I'm not yet sure how this works, but I'll dig further into this. Many thanks for sharing pyodbc with the community. Alexandre
  • Dec 08, 2009
    ConnectionStrings (Connecting to Databases) Wiki page commented on by omprakash.rudhru   -   I am trying to connect to Adaptive server anywhere 9.0 In ASE 9.0, we can mention the location of the database file ex:om.db in the dsn. Can anyone tell me how to connect mentioning all the details in the connection string including the driver and database location (ex: c:\om.db)
    I am trying to connect to Adaptive server anywhere 9.0 In ASE 9.0, we can mention the location of the database file ex:om.db in the dsn. Can anyone tell me how to connect mentioning all the details in the connection string including the driver and database location (ex: c:\om.db)
  • Nov 30, 2009
    issue 49 (problem with variable assignment) commented on by long.haired.steve   -   hmmm, I solved the problem immediately after posting. Adding a SET NOCOUNT ON to the SP I'd wrapped the code in made the problem go away. It seems with NO COUNT SQL Server was returning a resultset that was not a resultset...
    hmmm, I solved the problem immediately after posting. Adding a SET NOCOUNT ON to the SP I'd wrapped the code in made the problem go away. It seems with NO COUNT SQL Server was returning a resultset that was not a resultset...
  • Nov 30, 2009
    issue 49 (problem with variable assignment) commented on by long.haired.steve   -   I am seeing this issue on windows connecting to an SQL Server 2008 instance. The connection string looks like: 'DRIVER={SQL Server};TDS_Version=8.0;SERVER=%(host)s;DATABASE=%(database)s;UID=%(username)s;PWD=%(password)s' cursor.description is None I've tried both calling code like the above, and wrapping it in a stored procedure and calling that with both the EXEC and {CALL ...} syntax. I have tried with and without column aliasing and with and without an explicit cast to int. A DB side trace shows all statements executing as expected. Although I have to admit I have not idea what the sp_prepexec SP calls are supposed to look like.
    I am seeing this issue on windows connecting to an SQL Server 2008 instance. The connection string looks like: 'DRIVER={SQL Server};TDS_Version=8.0;SERVER=%(host)s;DATABASE=%(database)s;UID=%(username)s;PWD=%(password)s' cursor.description is None I've tried both calling code like the above, and wrapping it in a stored procedure and calling that with both the EXEC and {CALL ...} syntax. I have tried with and without column aliasing and with and without an explicit cast to int. A DB side trace shows all statements executing as expected. Although I have to admit I have not idea what the sp_prepexec SP calls are supposed to look like.

Earlier this year

  • Nov 22, 2009
    issue 80 (Proposed patch to setup.py to allow building eggs.) reported by bs1984   -   Use setuptools if available on the system (allows building eggs which our group uses to deploy modules with c extensions). setup.py 4c4,7 < from distutils.core import setup, Command --- > try: > from setuptools.core import setup, Command > except ImportError: > from distutils.core import setup, Command
    Use setuptools if available on the system (allows building eggs which our group uses to deploy modules with c extensions). setup.py 4c4,7 < from distutils.core import setup, Command --- > try: > from setuptools.core import setup, Command > except ImportError: > from distutils.core import setup, Command
  • Nov 16, 2009
    issue 79 (SPROC does not return results.) reported by sankumarasu   -   What steps will reproduce the problem? #Run Sproc on MS-SQL Server and fetch results to Python import pyodbc #connection string cstring='DRIVER={SQL Server};SERVER=myserver;DATABASE=mydb;UID=myUID;PWD=myPWD' #connection cnxn = pyodbc.connect(cstring,autocommit=True) #cursor cursor = cnxn.cursor() #The SQL CMD getSQLCMD="Execute spMovingAverage @weeks=8,@recency=0" print "The Get SQL Command :", getSQLCMD #Execute SPROC cursor.execute(getSQLCMD) #fetch records allRecords=cursor.fetchall() What is the expected output? What do you see instead? allrecords variable should have all the rows returned by the Sproc. Instead I get this error: 15 cursor.execute(getSQLCMD) 16 #fetch records ---> 17 allRecords=cursor.fetchall() 18 19 ProgrammingError: No results. Previous SQL was not a query. WARNING: Failure executing file: <Sproc_Test.py> What version of the product are you using? On what operating system? Python 2.5.4 MS SQL Server 2005 Please provide any additional information below.
    What steps will reproduce the problem? #Run Sproc on MS-SQL Server and fetch results to Python import pyodbc #connection string cstring='DRIVER={SQL Server};SERVER=myserver;DATABASE=mydb;UID=myUID;PWD=myPWD' #connection cnxn = pyodbc.connect(cstring,autocommit=True) #cursor cursor = cnxn.cursor() #The SQL CMD getSQLCMD="Execute spMovingAverage @weeks=8,@recency=0" print "The Get SQL Command :", getSQLCMD #Execute SPROC cursor.execute(getSQLCMD) #fetch records allRecords=cursor.fetchall() What is the expected output? What do you see instead? allrecords variable should have all the rows returned by the Sproc. Instead I get this error: 15 cursor.execute(getSQLCMD) 16 #fetch records ---> 17 allRecords=cursor.fetchall() 18 19 ProgrammingError: No results. Previous SQL was not a query. WARNING: Failure executing file: <Sproc_Test.py> What version of the product are you using? On what operating system? Python 2.5.4 MS SQL Server 2005 Please provide any additional information below.
  • Nov 14, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) commented on by maxim.chernobayev   -   compiled it after uninstalling/reinstalling "gcc-c++" package. Thank you.
    compiled it after uninstalling/reinstalling "gcc-c++" package. Thank you.
  • Nov 12, 2009
    issue 78 (UTF-16 in memory strings in results) reported by martijn.ras   -   What steps will reproduce the problem? 1 Setup odbc correctly. 2 Execute the following: import pyodbc database = pyodbc.connect('DSN=localhost') cursor = database.cursor() cursor.execute('SHOW CREATE TABLE mysql.users') print cursor.fetchall() cursor.close() database.close() 2 Notice the output being in UTF-16 in memory format, containing something like this: [(u'\U00730075\U00720065', u'\U00520043\U00410045\U00450054\U00540020 ... What is the expected output? What do you see instead? Something readable in UTF-8, containing something like this: ... `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', ... What version of the product are you using? On what operating system? pyodbc-2.1.5-2.fc11.i586 unixODBC-2.2.14-2.fc11.i586 mysql-5.1.37-1.fc11.i586 mysql-libs-5.1.37-1.fc11.i586 mysql-server-5.1.37-1.fc11.i586 mysql-connector-odbc-5.1.5r1144-4.fc11.i586
    What steps will reproduce the problem? 1 Setup odbc correctly. 2 Execute the following: import pyodbc database = pyodbc.connect('DSN=localhost') cursor = database.cursor() cursor.execute('SHOW CREATE TABLE mysql.users') print cursor.fetchall() cursor.close() database.close() 2 Notice the output being in UTF-16 in memory format, containing something like this: [(u'\U00730075\U00720065', u'\U00520043\U00410045\U00450054\U00540020 ... What is the expected output? What do you see instead? Something readable in UTF-8, containing something like this: ... `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', ... What version of the product are you using? On what operating system? pyodbc-2.1.5-2.fc11.i586 unixODBC-2.2.14-2.fc11.i586 mysql-5.1.37-1.fc11.i586 mysql-libs-5.1.37-1.fc11.i586 mysql-server-5.1.37-1.fc11.i586 mysql-connector-odbc-5.1.5r1144-4.fc11.i586
  • Nov 12, 2009
    GettingStarted (Quick Examples To Get You Started) Wiki page commented on by prah...@gmail.com   -   Very very very nice ! I need to access a lot of mdb, so i really need your library. Great job !
    Very very very nice ! I need to access a lot of mdb, so i really need your library. Great job !
  • Nov 11, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) commented on by maxim.chernobayev   -   Got it working on clean Ubuntu 9.04 after installing unixodbc-dev, gcc and some development stuff. Thank you, Will try a clean CentOS 5.3
    Got it working on clean Ubuntu 9.04 after installing unixodbc-dev, gcc and some development stuff. Thank you, Will try a clean CentOS 5.3
  • Nov 11, 2009
    issue 66 (No way to determine if a connection has been dropped) commented on by gbronner   -   To clarify: 1) This is using a python client connecting to Netezza via the linux ODBC library; client is running on linux. So this is a bit bleeding edge.
    To clarify: 1) This is using a python client connecting to Netezza via the linux ODBC library; client is running on linux. So this is a bit bleeding edge.
  • Nov 11, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) commented on by maxim.chernobayev   -   Thank you for prompt reply - you're right, other packages don't too. - python and gcc were not compiled but were installed with "yum install". I'll try to get the latest versions now. I've doublechecked I have the latest gcc and python: [root@hashed ~]# yum update python Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: mirror.rackspace.com * updates: pubmirrors.reflected.net * addons: mirrors.netdna.com * extras: www.muug.mb.ca Setting up Update Process Could not find update match for python No Packages marked for Update [root@hashed ~]# yum update gcc Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: mirror.rackspace.com * updates: pubmirrors.reflected.net * addons: mirrors.netdna.com * extras: mirrors.cmich.edu Setting up Update Process Could not find update match for gcc No Packages marked for Update Google gives no answers so far. Thank you for help
    Thank you for prompt reply - you're right, other packages don't too. - python and gcc were not compiled but were installed with "yum install". I'll try to get the latest versions now. I've doublechecked I have the latest gcc and python: [root@hashed ~]# yum update python Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: mirror.rackspace.com * updates: pubmirrors.reflected.net * addons: mirrors.netdna.com * extras: www.muug.mb.ca Setting up Update Process Could not find update match for python No Packages marked for Update [root@hashed ~]# yum update gcc Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: mirror.rackspace.com * updates: pubmirrors.reflected.net * addons: mirrors.netdna.com * extras: mirrors.cmich.edu Setting up Update Process Could not find update match for gcc No Packages marked for Update Google gives no answers so far. Thank you for help
  • Nov 11, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) Status changed by mkleehammer   -   What is happening is the Python distutils library, which is responsible for generating the compilation command line is passing two values that GCC 4.1.2 doesn't recognize: cc1plus: error: unrecognized command line option "-fstack-protector" cc1plus: error: invalid parameter `ssp-buffer-size' If I am thinking about this correctly, I believe it means that Python was compiled with these flags by CentOS, but the version of GCC provided does not recognize them. It is also possible that Python's distutils generated incorrect flags and that Python *wasn't* compiled that way. The versions look correct. Can you compile any Python C extensions? I would expect them all to fail the same way (since pyodbc isn't generating the command line). Also, try asking on the CentOS forums also. Perhaps someone has seen this before.
    Status: Investigating
    What is happening is the Python distutils library, which is responsible for generating the compilation command line is passing two values that GCC 4.1.2 doesn't recognize: cc1plus: error: unrecognized command line option "-fstack-protector" cc1plus: error: invalid parameter `ssp-buffer-size' If I am thinking about this correctly, I believe it means that Python was compiled with these flags by CentOS, but the version of GCC provided does not recognize them. It is also possible that Python's distutils generated incorrect flags and that Python *wasn't* compiled that way. The versions look correct. Can you compile any Python C extensions? I would expect them all to fail the same way (since pyodbc isn't generating the command line). Also, try asking on the CentOS forums also. Perhaps someone has seen this before.
    Status: Investigating
  • Nov 11, 2009
    Rows (Row API documentation) Wiki page commented on by adam.c.bernier   -   Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: {{{ x = 0 # column index for row in rows: print row.cursor_description[x][0] }}} That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
    Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: {{{ x = 0 # column index for row in rows: print row.cursor_description[x][0] }}} That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
  • Nov 11, 2009
    Rows (Row API documentation) Wiki page commented on by adam.c.bernier   -   Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: {{{ x = 0 # column index for row in rows: print row.cursor_description[x][0] }}} That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
    Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: {{{ x = 0 # column index for row in rows: print row.cursor_description[x][0] }}} That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
  • Nov 11, 2009
    Rows (Row API documentation) Wiki page commented on by adam.c.bernier   -   Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: x = 0 # column index for row in rows: print row.cursor_description[x][0] That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
    Hi Kevin, Nothing special needed to enable this; it just works! If you have trouble accessing the data via column name, try printing out the description like this: x = 0 # column index for row in rows: print row.cursor_description[x][0] That will return column name at index 0. It may just be that the database is returning an uppercase column name, and you're expecting a lowercase column name (this happened to me). Best regards, Adam
  • Nov 11, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) commented on by maxim.chernobayev   -   Forgot to mention Python version: Python 2.4.3 (#1, May 24 2008, 13:57:05) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
    Forgot to mention Python version: Python 2.4.3 (#1, May 24 2008, 13:57:05) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
  • Nov 11, 2009
    issue 77 (Error during installation: "-fstack-protector", `ssp-buffer-...) reported by maxim.chernobayev   -   What steps will reproduce the problem? 1. Log on to CentOS release 5.2 (Final) 2. Extract 2.1.6 zip and run "python setup.py build" What is the expected output? What do you see instead? pyodbc probably should compile, instead I'm getting error: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DPYODBC_MAJOR=2 - DPYODBC_MINOR=1 -DPYODBC_MICRO=6 -DPYODBC_BUILD=0 -I/usr/include/python2.4 -c /home/chernm/pyodbc-2.1.6/src/connection.cpp -o build/temp.linux-x86_64- 2.4/home/chernm/pyodbc-2.1.6/src/connection.o -Wno-write-strings cc1plus: error: unrecognized command line option "-fstack-protector" cc1plus: error: invalid parameter `ssp-buffer-size' /home/chernm/pyodbc-2.1.6/src/connection.cpp:1: error: bad value (generic) for -mtune= switch error: command 'gcc' failed with exit status 1 What version of the product are you using? On what operating system? 2.1.6, CentOS 5.2 Please provide any additional information below.
    What steps will reproduce the problem? 1. Log on to CentOS release 5.2 (Final) 2. Extract 2.1.6 zip and run "python setup.py build" What is the expected output? What do you see instead? pyodbc probably should compile, instead I'm getting error: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DPYODBC_MAJOR=2 - DPYODBC_MINOR=1 -DPYODBC_MICRO=6 -DPYODBC_BUILD=0 -I/usr/include/python2.4 -c /home/chernm/pyodbc-2.1.6/src/connection.cpp -o build/temp.linux-x86_64- 2.4/home/chernm/pyodbc-2.1.6/src/connection.o -Wno-write-strings cc1plus: error: unrecognized command line option "-fstack-protector" cc1plus: error: invalid parameter `ssp-buffer-size' /home/chernm/pyodbc-2.1.6/src/connection.cpp:1: error: bad value (generic) for -mtune= switch error: command 'gcc' failed with exit status 1 What version of the product are you using? On what operating system? 2.1.6, CentOS 5.2 Please provide any additional information below.
  • Nov 10, 2009
    issue 76 ([ODBC dBase Driver] "Optional feature not implemented") Status changed by mkleehammer   -   Great. I'll leave this open and make it generate an error if autocommit has the wrong case...
    Status: Investigating
    Great. I'll leave this open and make it generate an error if autocommit has the wrong case...
    Status: Investigating
  • Nov 09, 2009
    issue 76 ([ODBC dBase Driver] "Optional feature not implemented") commented on by faul...@iinet.net.au   -   DOH! pyodbc.connect(r"DRIVER={Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)};Dbq=d:\projects\todd", autocommit=True) appears to work
    DOH! pyodbc.connect(r"DRIVER={Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)};Dbq=d:\projects\todd", autocommit=True) appears to work
  • Nov 09, 2009
    issue 76 ([ODBC dBase Driver] "Optional feature not implemented") commented on by faul...@iinet.net.au   -   Addendum: Same error with Autocommit=True also
    Addendum: Same error with Autocommit=True also
  • Nov 09, 2009
    issue 76 ([ODBC dBase Driver] "Optional feature not implemented") reported by faul...@iinet.net.au   -   What steps will reproduce the problem? 1.pyodbc.connect(r"DRIVER={Microsoft dBASE Driver (*.dbf)};Autocommit=False;Dbq=d:\projects\todd") 2. 3. What is the expected output? What do you see instead? expect a connection object. get: pyodbc.Error: ('HYC00', '[HYC00] [Microsoft][ODBC dBase Driver]Optional feature not implemented (106) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))') What version of the product are you using? On what operating system? pyodbc-2.1.5-py2.6 Windoze XP Please provide any additional information below. Same error with or without 'Autocommit=False'
    What steps will reproduce the problem? 1.pyodbc.connect(r"DRIVER={Microsoft dBASE Driver (*.dbf)};Autocommit=False;Dbq=d:\projects\todd") 2. 3. What is the expected output? What do you see instead? expect a connection object. get: pyodbc.Error: ('HYC00', '[HYC00] [Microsoft][ODBC dBase Driver]Optional feature not implemented (106) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))') What version of the product are you using? On what operating system? pyodbc-2.1.5-py2.6 Windoze XP Please provide any additional information below. Same error with or without 'Autocommit=False'
  • Nov 06, 2009
    Building (Building pyodbc) Wiki page commented on by stanabe0917   -   To avoid gcc error on Ubuntu Linux, I did: {{{ $ sudo aptitude install g++ }}} I also installed the following 2 packages from Synaptic: * python-dev * tdsodbc To avoid 'no default driver specified' error when connecting to MSSQL db, I had to create /etc/odbcinst.ini and put the following entry: {{{ [SQL Server] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/odbc/libtdsodbc.so Setup = /usr/lib/odbc/libtdsS.so CPTimeout = CPReuse = }}} *Source*: http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg08435.html
    To avoid gcc error on Ubuntu Linux, I did: {{{ $ sudo aptitude install g++ }}} I also installed the following 2 packages from Synaptic: * python-dev * tdsodbc To avoid 'no default driver specified' error when connecting to MSSQL db, I had to create /etc/odbcinst.ini and put the following entry: {{{ [SQL Server] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/odbc/libtdsodbc.so Setup = /usr/lib/odbc/libtdsS.so CPTimeout = CPReuse = }}} *Source*: http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg08435.html
  • Nov 04, 2009
    issue 71 (python pyodbc - connect error) commented on by threaderslash   -   Hello Everybody, We have managed to put NotesSQL to work through ODBC with python to access data from our Lotus Notes *.NSF files. It works as queries using the same type of queries syntax you would need normally use to get the data when working on MS-Access to grab the info inside the Lotus Notes *.nsf file. But also, on windows, you have to connect without using UID, Server, and PWD -- it worked just like that: import pyodbc ... connection=pyodbc.connect("Driver={Lotus NotesSQL Driver (*.nsf)}; DATABASE=mydb.nsf", autocommit=True) After I will see how to enable to also use the other parameters - UID, etc. It should need some additional twigs on WinXP enviroment. But the important is, we got locally direct access to the data we needed -- using ODBC. Then we transferred the data from Lotus to our new MySQL db! Hope this info may save time and help others too. Yes... we love happy endings!
    Hello Everybody, We have managed to put NotesSQL to work through ODBC with python to access data from our Lotus Notes *.NSF files. It works as queries using the same type of queries syntax you would need normally use to get the data when working on MS-Access to grab the info inside the Lotus Notes *.nsf file. But also, on windows, you have to connect without using UID, Server, and PWD -- it worked just like that: import pyodbc ... connection=pyodbc.connect("Driver={Lotus NotesSQL Driver (*.nsf)}; DATABASE=mydb.nsf", autocommit=True) After I will see how to enable to also use the other parameters - UID, etc. It should need some additional twigs on WinXP enviroment. But the important is, we got locally direct access to the data we needed -- using ODBC. Then we transferred the data from Lotus to our new MySQL db! Hope this info may save time and help others too. Yes... we love happy endings!
  • Oct 30, 2009
    Cursor (Cursor API documentation) Wiki page edited by mkleehammer   -   Revision r73 Edited wiki page through web user interface.
    Revision r73 Edited wiki page through web user interface.
  • Oct 29, 2009
    GettingStarted (Quick Examples To Get You Started) Wiki page commented on by karen.hensley   -   Very helpful! Thank you.
    Very helpful! Thank you.
  • Oct 27, 2009
    issue 74 (Issue with executing query) Status changed by mkleehammer   -   Two things: (1) The error message is saying that the first argument must be the actual SQL and it must be a string or Unicode value: cursor.execute("select * from x"). The error is saying you passed something else. (2) pyodbc only supports a SQL interface -- you won't be able to pass dictionaries, etc. Are you sure you are using the right product? You might be looking for something like SQLObject or something. If you still think there is a pyodbc problem, past a bit of the code here so we can see. Also, for help from lots of people, you might find the pyodbc discussion group handy: http://groups.google.com/group/pyodbc
    Status: Investigating
    Two things: (1) The error message is saying that the first argument must be the actual SQL and it must be a string or Unicode value: cursor.execute("select * from x"). The error is saying you passed something else. (2) pyodbc only supports a SQL interface -- you won't be able to pass dictionaries, etc. Are you sure you are using the right product? You might be looking for something like SQLObject or something. If you still think there is a pyodbc problem, past a bit of the code here so we can see. Also, for help from lots of people, you might find the pyodbc discussion group handy: http://groups.google.com/group/pyodbc
    Status: Investigating
  • Oct 27, 2009
    issue 73 (a single-quote ' in a comment will hide following parameter ...) commented on by terminatorul   -   Ok, sorry for the misplaced post. I use PosgreSql with pgODBC and unixODBC and I have also had other problems with this driver. Unlike other problems with the driver, this one raised ProgrammingError so I thought pyodbc would be the cause ... Can you please asses if the problem is in pgODBC or in unixODBC ? For me they are both poor and not very reliable, so equally likely to introduce the bug ...
    Ok, sorry for the misplaced post. I use PosgreSql with pgODBC and unixODBC and I have also had other problems with this driver. Unlike other problems with the driver, this one raised ProgrammingError so I thought pyodbc would be the cause ... Can you please asses if the problem is in pgODBC or in unixODBC ? For me they are both poor and not very reliable, so equally likely to introduce the bug ...
  • Oct 27, 2009
    issue 75 (Issue with executing query) commented on by sucking.sux   -   For some reason, this issue appears twice. Sorry for the inconvenience.
    For some reason, this issue appears twice. Sorry for the inconvenience.
  • Oct 27, 2009
    issue 75 (Issue with executing query) reported by sucking.sux   -   When trying to submit a python dictionary which is nested inside a list, I get the following error: The first argument to execute must be a string or unicode query. I use the latest pyodbc pre-compiled version for python 2.6.2 on Win7. MySQL came with the current xampp-package and uses default settings.
    When trying to submit a python dictionary which is nested inside a list, I get the following error: The first argument to execute must be a string or unicode query. I use the latest pyodbc pre-compiled version for python 2.6.2 on Win7. MySQL came with the current xampp-package and uses default settings.
  • Oct 27, 2009
    issue 74 (Issue with executing query) reported by sucking.sux   -   When trying to submit a python dictionary which is nested inside a list, I get the following error: The first argument to execute must be a string or unicode query. I use the latest pyodbc pre-compiled version for python 2.6.2 on Win7. MySQL came with the current xampp-package and uses default settings.
    When trying to submit a python dictionary which is nested inside a list, I get the following error: The first argument to execute must be a string or unicode query. I use the latest pyodbc pre-compiled version for python 2.6.2 on Win7. MySQL came with the current xampp-package and uses default settings.
  • Oct 26, 2009
    issue 73 (a single-quote ' in a comment will hide following parameter ...) Status changed by mkleehammer   -   This appears to be an issue with the driver. pyodbc doesn't actually read the query - it is generally passed on to the driver with no modifications. I created a similar query and tested against SQL Server 2008 on Windows and it correctly processes the comment containing a single quote. What database and driver are you using?
    Status: Investigating
    This appears to be an issue with the driver. pyodbc doesn't actually read the query - it is generally passed on to the driver with no modifications. I created a similar query and tested against SQL Server 2008 on Windows and it correctly processes the comment containing a single quote. What database and driver are you using?
    Status: Investigating
  • Oct 26, 2009
    issue 73 (a single-quote ' in a comment will hide following parameter ...) reported by terminatorul   -   What steps will reproduce the problem? 1. write a query with parameters (paramter markers) and with a comment before the markers, that includes an unmatched single-quote 2. connect to a database 3. execute query with cursor.execute, providing the query parameters What is the expected output? What do you see instead? I get: ProgrammingError: ('The SQL contains 0 parameter markers, but 1 parameters were supplied', 'HY000') What version of the product are you using? On what operating system? pyodbc-2.1.6 on Ubuntu Linux Please provide any additional information below. You have my query attached. It is rather large, so you should write: cusor.execute(open('query.sql', 'r').read(), ('10',)) to execute it.
    What steps will reproduce the problem? 1. write a query with parameters (paramter markers) and with a comment before the markers, that includes an unmatched single-quote 2. connect to a database 3. execute query with cursor.execute, providing the query parameters What is the expected output? What do you see instead? I get: ProgrammingError: ('The SQL contains 0 parameter markers, but 1 parameters were supplied', 'HY000') What version of the product are you using? On what operating system? pyodbc-2.1.6 on Ubuntu Linux Please provide any additional information below. You have my query attached. It is rather large, so you should write: cusor.execute(open('query.sql', 'r').read(), ('10',)) to execute it.
  • Oct 23, 2009
    Rows (Row API documentation) Wiki page commented on by millsks   -   I was just curious if there is something special that needs to be done to the cursor or the row object in order to process the row using the column names instead of list indices. Kevin
    I was just curious if there is something special that needs to be done to the cursor or the row object in order to process the row using the column names instead of list indices. Kevin
  • Oct 22, 2009
    issue 71 (python pyodbc - connect error) commented on by threaderslash   -   Hi again.. I have done the same test using pyodbc, but to MySQL ODBC driver. It works fine for MySQL. The problem still remains to Lotus Notes. Any other hints please?
    Hi again.. I have done the same test using pyodbc, but to MySQL ODBC driver. It works fine for MySQL. The problem still remains to Lotus Notes. Any other hints please?
  • Oct 22, 2009
    issue 71 (python pyodbc - connect error) commented on by threaderslash   -   Hi Thanks.. I have already tried with {} - conn = pyodbc.connect("DRIVER={Lotus NotesSQL Driver};SERVER=local;UID=John Meyer;PWD=yellowbird;DATABASE= mydb.nsf") still gives me the same error: pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnectW)') Any other help please? cheers... ThreaderSlash
    Hi Thanks.. I have already tried with {} - conn = pyodbc.connect("DRIVER={Lotus NotesSQL Driver};SERVER=local;UID=John Meyer;PWD=yellowbird;DATABASE= mydb.nsf") still gives me the same error: pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnectW)') Any other help please? cheers... ThreaderSlash
  • Oct 22, 2009
    issue 72 (TestResult on MSSQL connection.) Status changed by mkleehammer   -  
    Status: Investigating
    Status: Investigating
  • Oct 22, 2009
    issue 72 (TestResult on MSSQL connection.) reported by enricose...@hotmail.com   -   Hi people, I'm trying to use pyodbc on linux (Ubuntu 9.04) but I have a lot of problems. I'm using pyodbc from Windows for a lot of time and I did never have very issue. Now, on linux, I get error on executing simple query and the response is: """ res = cur.fetchall() pyodbc.ProgrammingError: No results. Previous SQL was not a query. """ So I did try the test on MSSQL connection and I did obtain the content of the attachment: a lot of error! Have I some problem in my system or there is some problem in pyodbc linux vesion. Best regards.
    Hi people, I'm trying to use pyodbc on linux (Ubuntu 9.04) but I have a lot of problems. I'm using pyodbc from Windows for a lot of time and I did never have very issue. Now, on linux, I get error on executing simple query and the response is: """ res = cur.fetchall() pyodbc.ProgrammingError: No results. Previous SQL was not a query. """ So I did try the test on MSSQL connection and I did obtain the content of the attachment: a lot of error! Have I some problem in my system or there is some problem in pyodbc linux vesion. Best regards.
  • Oct 22, 2009
    issue 71 (python pyodbc - connect error) Status changed by mkleehammer   -   You are missing the opening brace for the driver keyword: DRIVER=Lotus NotesSQL Driver} should be : DRIVER={Lotus NotesSQL Driver} Let us know how that works.
    Status: Investigating
    You are missing the opening brace for the driver keyword: DRIVER=Lotus NotesSQL Driver} should be : DRIVER={Lotus NotesSQL Driver} Let us know how that works.
    Status: Investigating
  • Oct 21, 2009
    issue 71 (python pyodbc - connect error) reported by threaderslash   -   What steps will reproduce the problem? 1. I am using Eclipse IDE with Python 2.5; need to read content from a Lotus Notes database, so run some basic query like - SELECT peronname FROM tablename. 2. 'import pyodbc' is ok - python see it! 3. But it doesn't connect, when I try to run conn = pyodbc.connect("DRIVER=Lotus NotesSQL Driver};SERVER=local;UID=John Meyer;PWD=yellowbird;DATABASE=mydb.nsf") What is the expected output? What do you see instead? It should connect. But it gives me the error: pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnectW)') What version of the product are you using? On what operating system? pyodbc25 WinXP Please provide any additional information below. Please, any hint or suggestion? Thanks in advance.
    What steps will reproduce the problem? 1. I am using Eclipse IDE with Python 2.5; need to read content from a Lotus Notes database, so run some basic query like - SELECT peronname FROM tablename. 2. 'import pyodbc' is ok - python see it! 3. But it doesn't connect, when I try to run conn = pyodbc.connect("DRIVER=Lotus NotesSQL Driver};SERVER=local;UID=John Meyer;PWD=yellowbird;DATABASE=mydb.nsf") What is the expected output? What do you see instead? It should connect. But it gives me the error: pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnectW)') What version of the product are you using? On what operating system? pyodbc25 WinXP Please provide any additional information below. Please, any hint or suggestion? Thanks in advance.
  • Oct 08, 2009
    issue 21 (Cannot write to Access Database) commented on by m...@adfan.be   -   Hello, I have had a similar problem: on one database, I could insert but not on the other one. The difference: in the first case, a primary key was defined but not on the other one. I guess Access drivers prevents you from inserting rows in a table where no primary key is defined. Hope this helps.
    Hello, I have had a similar problem: on one database, I could insert but not on the other one. The difference: in the first case, a primary key was defined but not on the other one. I guess Access drivers prevents you from inserting rows in a table where no primary key is defined. Hope this helps.
  • Oct 01, 2009
    ConnectionStrings (Connecting to Databases) Wiki page commented on by alx3apps   -   For sqlserver named instances you can use this syntax: {{{ ...SERVER=<hostname>\<instancename>... }}}
    For sqlserver named instances you can use this syntax: {{{ ...SERVER=<hostname>\<instancename>... }}}
  • Oct 01, 2009
    issue 29 (Unicode query strings) commented on by jeremiah.campbell   -   I tested this problem on snow leopard + latest freetds stable + latest pyodbc from github. The above test case does not produce any errors. If you attempt to print results from each time I cursor.execute() is called I get the following error. Traceback (most recent call last): File "issue29.py", line 22, in <module> print u.fetchone() pyodbc.ProgrammingError: No results. Previous SQL was not a query. The original problem I reported seems to have been solved with the fix you described in comment 4. The cursor stays the cursor and does not become a -1. I would still like to understand why unicode query strings seem to not work or if I am doing something wrong but I would say this main issue is resolved.
    I tested this problem on snow leopard + latest freetds stable + latest pyodbc from github. The above test case does not produce any errors. If you attempt to print results from each time I cursor.execute() is called I get the following error. Traceback (most recent call last): File "issue29.py", line 22, in <module> print u.fetchone() pyodbc.ProgrammingError: No results. Previous SQL was not a query. The original problem I reported seems to have been solved with the fix you described in comment 4. The cursor stays the cursor and does not become a -1. I would still like to understand why unicode query strings seem to not work or if I am doing something wrong but I would say this main issue is resolved.
  • Oct 01, 2009
    issue 46 (mssql unique identifier data type) commented on by jeremiah.campbell   -   I have recently upgraded to latest pyodbc off of github, dropped commercial Actual Technologies odbc driver, installed latest stable freetds, and upgraded to snow leopard. I can not point to which one of these fixed this problem but I am no longer seeing it. Sorry I have not had time to do more testing to isolate exactly what was causing the problem on my end but I am glad it is working.
    I have recently upgraded to latest pyodbc off of github, dropped commercial Actual Technologies odbc driver, installed latest stable freetds, and upgraded to snow leopard. I can not point to which one of these fixed this problem but I am no longer seeing it. Sorry I have not had time to do more testing to isolate exactly what was causing the problem on my end but I am glad it is working.
 
Hosted by Google Code