Coder Social home page Coder Social logo

pymssql's Introduction

pymssql
#######

Building
========

To build pymssql you should have:

* python >= 2.5 including development files. Please research your OS usual
  software distribution channels, e.g, ``python-dev`` or ``python-devel``
  packages)
* Cython >= 0.15
* FreeTDS >= 0.91 including development files. Please research your OS usual
  software distribution channels, e.g, ``freetds-dev`` or ``freetds-devel``
  packages)

Windows
-------

MinGW
^^^^^

Add to the above requirements:

* MinGW

then you can run::

  python setup.py build -c mingw32

which will build pymssql in the normal python fashion.

MS Visual C++
^^^^^^^^^^^^^

Environment Setup:
~~~~~~~~~~~~~~~~~~

The commands below should be ran inside a Visual Studio command prompt or a
command prompt window where the ``vcsvars*.bat`` file has been previously run so
it can set the needed environment vars.

Building FreeTDS:
~~~~~~~~~~~~~~~~~

Build FreeTDS from the current_ or stable_ tarball.

.. _current: http://ibiblio.org/pub/Linux/ALPHA/freetds/current/
.. _stable: http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/

Use ``nmake`` (included with VS C++) to build FreeTDS.  To do that,

Define in the environment or on the command line:

1. ``CONFIGURATION`` = ``debug``/``release``
2. ``PLATFORM`` = ``win32``/``x64``

These will determine what is built and where outputs are placed.

Example invocations::

  nmake.exe -f Nmakefile -nologo PLATFORM=win32 CONFIGURATION=debug
  nmake.exe -f Nmakefile -nologo build-win32d

Fixing build errors:  I ran into a couple build errors when using VS 2008, see
the following links for resolutions:

- http://www.freetds.org/userguide/osissues.htm
- http://lists.ibiblio.org/pipermail/freetds/2010q4/026343.html

When this is done, the following files should be available (depending on
``CONFIGURATION`` and ``PLATFORM`` used above)::

  src\dblib\<PLATFORM>\<CONFIGURATION>\db-lib.lib
  src\tds\<PLATFORM>\<CONFIGURATION>\tds.lib

for example::

  src\dblib\win32\release\db-lib.lib
  src\dblib\win32\release\tds.lib

Those files should then be copied to::

  <pymssql root>\freetds\vs2008_<bitness>\lib\

for example::

  <pymssql root>\freetds\vs2008_32\lib\
  <pymssql root>\freetds\vs2008_64\lib\

The location obviously depends on whether you are performing a 32 or 64 bit
build.

.. note::

  This process is currently only tested with Visual Studio 2008 targeting a
  32-bit build. If you run into problems, please post to the mailing list.

Then you can simply run::

  python setup.py build

or other ``setup.py`` commands as needed.

Unix
====

To build on Unix you must also have:

* gcc

Then you can simply run::

  python setup.py build

or other ``setup.py`` commands as needed.

Testing
=======

.. danger::

  ALL DATA IN TESTING DBS WILL BE DELETED !!!!

You will need to install two additional packages for testing::

  easy_install nose SQLAlchemy

You should build the package with::

  python setup.py develop

You need to setup a ``tests.cfg`` file in ``tests/`` with the correct DB
connection information for your environement::

  cd tests/
  cp tests.cfg.tpl tests.cfg
  vim|emacs|notepad tests.cfg

To run the tests::

  cd tests/
  nosetests

Which will go through and run all the tests with the settings from the ``DEFAULT``
section of ``tests.cfg``.

To run with a different ``tests.cfg`` section::

  nosetests --pymssql-section=<secname>

example::

  nosetests --pymssql-section=AllTestsWillRun

to avoid slow tests::

  nosetests -a '!slow'

to select specific tests to run::

  nosetests test_types.py
  nosetests test_types.py test_sprocs.py
  nosetests test_types.py:TestTypes
  nosetests test_types.py:TestTypes.test_image

pymssql's People

Contributors

msabramo avatar rsyring avatar

Watchers

James Cloos avatar

pymssql's Issues

nextset always returns true

Using pymssql 1.0.2 on a Ubuntu machine.

To reproduce the problem you may use this code:

cursor = connection.cursor()
ret = cursor.execute("select 1")
while 1:
    if 0 == cursor.nextset():
        break
raise Exception("boom!")

Agains my expectation, the exception never geets thrown and the loop goes on 
forever.

Original issue reported on code.google.com by [email protected] on 7 Sep 2010 at 6:01

Cursor.fetchall() returns None when as_dict=True

What steps will reproduce the problem?
1. Create a connection with as_dict=True argument
2. Create a cursor and execute a query
3. Call cursor's fetchall() method

What is the expected output? What do you see instead?

Should return a list of zero or more dicts but returns None instead.

What version of the product are you using? On what operating system?

pymssql-1.9.908 on Mac OS X 10.5.8

Please provide any additional information below.

Patch attached.

Original issue reported on code.google.com by [email protected] on 16 Jun 2010 at 3:27

Attachments:

ZipFile don't has the attribute 'extractall' error for python2.5

What steps will reproduce the problem?
1. python setup.py install
2.
3.

What is the expected output? What do you see instead?

AttributeError: ZipFile instance has no attribute 'extractall'

What version of the product are you using? On what operating system?

windows xp, python2.5

Please provide any additional information below.

in pythoon2.5 ZipFile don't has the attribute 'extractall', 

>>> from zipfile import ZipFile
>>> dir(ZipFile)
['_GetContents', '_RealGetContents', '__del__', '__doc__', '__init__', '__module
__', '_writecheck', 'close', 'fp', 'getinfo', 'infolist', 'namelist', 'printdir'
, 'read', 'testzip', 'write', 'writestr']


Original issue reported on code.google.com by [email protected] on 18 Jun 2010 at 3:32

running against CVS version of FreeTDS fails

I downloaded a copy of FreeTDS from CVS, built it, and then compiled pymssql.  
When running a simple test script, I get:

  File "_mssql.pyx", line 477, in _mssql.MSSQLConnection.__init__ (_mssql.c:4092)
    raise MSSQLDriverException("Connection to the database failed for an unknown reason.")
_mssql.MSSQLDriverException: Connection to the database failed for an unknown 
reason.


I can run the same test script with the FreeTDS version that ships with Ubuntu 
10.04.

Original issue reported on code.google.com by [email protected] on 7 Apr 2011 at 2:35

All Zip Files are Corrupt

What steps will reproduce the problem?
1. Download any zip file from "Downloads".
2. Attempt to unzip.
3. Bash head on keyboard.

What is the expected output? What do you see instead?
I expect the file to unzip.  However, the zip files are all obviously 
incomplete as they are less than 1kb.

What version of the product are you using? On what operating system?
1.9.906

Please provide any additional information below.
Don't upload broken zipfiles.

Original issue reported on code.google.com by [email protected] on 13 Apr 2010 at 9:48

Not compatible with cython 0.13

What steps will reproduce the problem?
Use cython >= 0.13 to build the package.

What version of the product are you using? On what operating system?
SVN revision 206 on Ubuntu 10.04.

In cython 0.13 bool is no longer a valid type name by default. 
http://wiki.cython.org/ReleaseNotes-0.13

I have attached a patch that uses bint instead of bool.

Original issue reported on code.google.com by [email protected] on 21 Sep 2010 at 7:50

Attachments:

Threaded Tests caused crash

testErrorSprocThreadedUse (tests.test_threaded.ThreadedTests) ... SKIP
testErrorThreadedUse (tests.test_threaded.ThreadedTests) ... ok
testThreadedUse (tests.test_threaded.ThreadedTests) ... *** glibc detected *** 
/home/rsyring/.virtualenvs/pymssql/bin/python: double free or corruption 
(!prev): 0x0000000002a129a0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x775b6)[0x7faf3d57c5b6]
/lib/libc.so.6(cfree+0x73)[0x7faf3d582e83]
/home/rsyring/.virtualenvs/pymssql/bin/python[0x44fc6f]
/home/rsyring/.virtualenvs/pymssql/bin/python(PyObject_GenericGetAttr+0x140)[0x4
53d10]
/home/rsyring/.virtualenvs/pymssql/bin/python(PyEval_EvalFrameEx+0x2b75)[0x4a566
5]
/home/rsyring/.virtualenvs/pymssql/bin/python(PyEval_EvalFrameEx+0x5a60)[0x4a855
0]
======= Memory map: ========
00400000-0061c000 r-xp 00000000 fc:00 3039687                            
/home/rsyring/.virtualenvs/pymssql/bin/python
0081b000-0081c000 r--p 0021b000 fc:00 3039687                            
/home/rsyring/.virtualenvs/pymssql/bin/python
0081c000-0087e000 rw-p 0021c000 fc:00 3039687                            
/home/rsyring/.virtualenvs/pymssql/bin/python
0087e000-0088d000 rw-p 00000000 00:00 0 
02338000-03441000 rw-p 00000000 00:00 0                                  [heap]
7faf34000000-7faf34021000 rw-p 00000000 00:00 0 
7faf34021000-7faf38000000 ---p 00000000 00:00 0 
7faf393de000-7faf393f4000 r-xp 00000000 fc:00 603                        
/lib/libgcc_s.so.1
7faf393f4000-7faf395f3000 ---p 00016000 fc:00 603                        
/lib/libgcc_s.so.1
7faf395f3000-7faf395f4000 r--p 00015000 fc:00 603                        
/lib/libgcc_s.so.1
7faf395f4000-7faf395f5000 rw-p 00016000 fc:00 603                        
/lib/libgcc_s.so.1
7faf395f5000-7faf395f6000 ---p 00000000 00:00 0 
7faf395f6000-7faf39df6000 rw-p 00000000 00:00 0 
7faf39df6000-7faf39df7000 ---p 00000000 00:00 0 
7faf39df7000-7faf3a5f7000 rw-p 00000000 00:00 0 
7faf3a5f7000-7faf3a5f9000 r-xp 00000000 fc:00 14450                      
/lib/libnss_mdns4.so.2
7faf3a5f9000-7faf3a7f8000 ---p 00002000 fc:00 14450                      
/lib/libnss_mdns4.so.2
7faf3a7f8000-7faf3a7f9000 r--p 00001000 fc:00 14450                      
/lib/libnss_mdns4.so.2
7faf3a7f9000-7faf3a7fa000 rw-p 00002000 fc:00 14450                      
/lib/libnss_mdns4.so.2
7faf3a7fa000-7faf3a810000 r-xp 00000000 fc:00 20688                      
/lib/libresolv-2.11.1.so
7faf3a810000-7faf3aa0f000 ---p 00016000 fc:00 20688                      
/lib/libresolv-2.11.1.so
7faf3aa0f000-7faf3aa10000 r--p 00015000 fc:00 20688                      
/lib/libresolv-2.11.1.so
7faf3aa10000-7faf3aa11000 rw-p 00016000 fc:00 20688                      
/lib/libresolv-2.11.1.so
7faf3aa11000-7faf3aa13000 rw-p 00000000 00:00 0 
7faf3aa13000-7faf3aa18000 r-xp 00000000 fc:00 20681                      
/lib/libnss_dns-2.11.1.so
7faf3aa18000-7faf3ac17000 ---p 00005000 fc:00 20681                      
/lib/libnss_dns-2.11.1.so
7faf3ac17000-7faf3ac18000 r--p 00004000 fc:00 20681                      
/lib/libnss_dns-2.11.1.so
7faf3ac18000-7faf3ac19000 rw-p 00005000 fc:00 20681                      
/lib/libnss_dns-2.11.1.so
7faf3ac19000-7faf3ac1b000 r-xp 00000000 fc:00 14451                      
/lib/libnss_mdns4_minimal.so.2
7faf3ac1b000-7faf3ae1a000 ---p 00002000 fc:00 14451                      
/lib/libnss_mdns4_minimal.so.2
7faf3ae1a000-7faf3ae1b000 r--p 00001000 fc:00 14451                      
/lib/libnss_mdns4_minimal.so.2
7faf3ae1b000-7faf3ae1c000 rw-p 00002000 fc:00 14451                      
/lib/libnss_mdns4_minimal.so.2
7faf3ae1c000-7faf3ae1e000 r-xp 00000000 fc:00 1050680                    
/usr/lib/gconv/CP1252.so
7faf3ae1e000-7faf3b01d000 ---p 00002000 fc:00 1050680                    
/usr/lib/gconv/CP1252.so
7faf3b01d000-7faf3b01e000 r--p 00001000 fc:00 1050680                    
/usr/lib/gconv/CP1252.so
7faf3b01e000-7faf3b01f000 rw-p 00002000 fc:00 1050680                    
/usr/lib/gconv/CP1252.so
7faf3b01f000-7faf3b021000 r-xp 00000000 fc:00 1056540                    
/usr/lib/gconv/ISO8859-1.so
7faf3b021000-7faf3b220000 ---p 00002000 fc:00 1056540                    
/usr/lib/gconv/ISO8859-1.so
7faf3b220000-7faf3b221000 r--p 00001000 fc:00 1056540                    
/usr/lib/gconv/ISO8859-1.so
7faf3b221000-7faf3b222000 rw-p 00002000 fc:00 1056540                    
/usr/lib/gconv/ISO8859-1.so
7faf3b222000-7faf3b22e000 r-xp 00000000 fc:00 20682                      
/lib/libnss_files-2.11.1.so
7faf3b22e000-7faf3b42d000 ---p 0000c000 fc:00 20682                      
/lib/libnss_files-2.11.1.so
7faf3b42d000-7faf3b42e000 r--p 0000b000 fc:00 20682                      
/lib/libnss_files-2.11.1.so
7faf3b42e000-7faf3b42f000 rw-p 0000c000 fc:00 20682                      
/lib/libnss_files-2.11.1.so
7faf3b42f000-7faf3b439000 r-xp 00000000 fc:00 20684                      
/lib/libnss_nis-2.11.1.so
7faf3b439000-7faf3b638000 ---p 0000a000 fc:00 20684                      
/lib/libnss_nis-2.11.1.so
7faf3b638000-7faf3b639000 r--p 00009000 fc:00 20684                      
/lib/libnss_nis-2.11.1.so
7faf3b639000-7faf3b63a000 rw-p 0000a000 fc:00 20684                      
/lib/libnss_nis-2.11.1.so
7faf3b63a000-7faf3b651000 r-xp 00000000 fc:00 20677                      
/lib/libnsl-2.11.1.so
7faf3b651000-7faf3b850000 ---p 00017000 fc:00 20677                      
/lib/libnsl-2.11.1.so
7faf3b850000-7faf3b851000 r--p 00016000 fc:00 20677                      
/lib/libnsl-2.11.1.so
7faf3b851000-7faf3b852000 rw-p 00017000 fc:00 20677                      
/lib/libnsl-2.11.1.so
7faf3b852000-7faf3b854000 rw-p 00000000 00:00 0 
7faf3b854000-7faf3b85c000 r-xp 00000000 fc:00 20678                      
/lib/libnss_compat-2.11.1.so
7faf3b85c000-7faf3ba5b000 ---p 00008000 fc:00 20678                      
/lib/libnss_compat-2.11.1.so
7faf3ba5b000-7faf3ba5c000 r--p 00007000 fc:00 20678                      
/lib/libnss_compat-2.11.1.so
7faf3ba5c000-7faf3ba5d000 rw-p 00008000 fc:00 20678                      
/lib/libnss_compat-2.11.1.so
7faf3ba5d000-7faf3ba79000 r-xp 00000000 fc:00 2892531                    
/home/rsyring/dev/python/pymssql/pymssql-src/pymssql.so
7faf3ba79000-7faf3bc78000 ---p 0001c000 fc:00 2892531                    
/home/rsyring/dev/python/pymssql/pymssql-src/pymssql.so
7faf3bc78000-7faf3bc79000 r--p 0001b000 fc:00 2892531                    
/home/rsyring/dev/python/pymssql/pymssql-src/pymssql.so
7faf3bc79000-7faf3bc7d000 rw-p 0001c000 fc:00 2892531                    
/home/rsyring/dev/python/pymssql/pymssql-src/pymssql.so
7faf3bc7d000-7faf3bc7e000 rw-p 00000000 00:00 0 
7faf3bc7e000-7faf3bc84000 r-xp 00000000 fc:00 789208                     
/usr/lib/python2.6/dist-packages/zope/interface/_zope_interface_coptimizations.s
oAborted


But i was not able to reproduce a second time.

Original issue reported on code.google.com by [email protected] on 16 Apr 2011 at 7:25

date column returns day value that is out of range

I have the trunk building against FreeTDS shipped with Ubuntu 10.04 
(0.82-1build6).  I have also done a special build to use the configure line:

 --enable-msdblib

with the same results.  I did some debugging and the number being returned for 
di.day is 96.

Debug output follows:

2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 BEGIN 
(implicit)
2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 SELECT 
auth_applications.id AS auth_applications_id, auth_applications.createdts AS 
auth_applications_createdts, auth_applications.updatedts AS 
auth_applications_updatedts, auth_applications.name AS auth_applications_name 
FROM auth_applications 
WHERE auth_applications.id = %(param_1)s
2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 
{'param_1': 1}
+++ _mssql.MSSQLConnection.execute_query()
+++ _mssql.MSSQLConnection.format_and_run_query()
+++ _mssql.MSSQLConnection.cancel()
+++ _mssql.assert_connected()
+++ _mssql.MSSQLConnection.clear_metadata()
+++ _mssql.MSSQLConnection.format_sql_command()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.clear_metadata()
+++ _mssql.MSSQLConnection.get_header()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.get_header()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.assert_connected()
+++ _mssql.assert_connected()
+++ _mssql.MSSQLConnection.fetch_next_row_dict()
+++ _mssql.MSSQLConnection.fetch_next_row()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.get_row()
Processing row 52, column 1,Got data=313e620, coltype=56, len=4
+++ _mssql.MSSQLConnection.convert_db_value()
Processing row 52, column 2,Got data=313e628, coltype=61, len=8
+++ _mssql.MSSQLConnection.convert_db_value()
Traceback (most recent call last):
  File "/home/rsyring/dev/customers/pai/paiauth-venv/bin/nosetests", line 8, in <module>
    load_entry_point('nose==1.0.0', 'console_scripts', 'nosetests')()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/core.py", line 118, in __init__
    **extra_args)
  File "/usr/lib/python2.6/unittest.py", line 816, in __init__
    self.parseArgs(argv)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/core.py", line 135, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/config.py", line 330, in configure
    self.plugins.begin()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/nose_plugin.py", line 89, in begin
    signal('blazeweb.pre_test_init').send()
  File "build/bdist.linux-x86_64/egg/blinker/base.py", line 220, in send
  File "/home/rsyring/dev/blaze/sabwc-src/default/sqlalchemybwc/events.py", line 7, in setup_db_structure
    run_tasks(settings.components.sqlalchemy.pre_test_init_tasks)
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/tasks.py", line 99, in run_tasks
    callable_retval = call_tuple[2]()
  File "<string>", line 2, in action_30_base_data
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/tasks.py", line 9, in _attributes
    return f(*args, **kwargs)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/src/paiauth-dist/paicore/tasks/init_db.py", line 14, in action_30_base_data
    paicsa_app = Application.get_or_create('paicsa')
  File "/home/rsyring/dev/customers/pai/paiauth-venv/src/paiauth-dist/paicore/components/auth/model/orm.py", line 51, in get_or_create
    settings.app_ids[abbr] = app.id
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/attributes.py", line 168, in __get__
    instance_dict(instance))
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/attributes.py", line 388, in get
    value = callable_(passive=passive)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/state.py", line 287, in __call__
    self.manager.deferred_scalar_loader(self, toload)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2492, in _load_scalar_attributes
    only_load_props=attribute_names)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1958, in _get
    return q.one()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1646, in one
    ret = list(self)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1791, in instances
    fetch = cursor.fetchall()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 2498, in fetchall
    l = self.process_rows(self._fetchall_impl())
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 2465, in _fetchall_impl
    return self.cursor.fetchall()
  File "pymssql.pyx", line 436, in pymssql.Cursor.fetchall (pymssql.c:5453)
    type(r) == int]) for row in self._source._conn]
  File "_mssql.pyx", line 331, in _mssql.MSSQLRowIterator.__next__ (_mssql.c:2979)
    return self.conn.fetch_next_row_dict(1)
  File "_mssql.pyx", line 891, in _mssql.MSSQLConnection.fetch_next_row_dict (_mssql.c:8276)
    row = self.fetch_next_row(throw)
  File "_mssql.pyx", line 884, in _mssql.MSSQLConnection.fetch_next_row (_mssql.c:8203)
    return self.get_row(rtc)
  File "_mssql.pyx", line 1034, in _mssql.MSSQLConnection.get_row (_mssql.c:9441)
    record += (self.convert_db_value(data, col_type, len),)
  File "_mssql.pyx", line 619, in _mssql.MSSQLConnection.convert_db_value (_mssql.c:5502)
    return datetime.datetime(di.year, di.month, di.day,
ValueError: day is out of range for month


Original issue reported on code.google.com by [email protected] on 7 Apr 2011 at 5:04

Python 2.7 support

Since 2.7 now appears to be Python's "official" version I'm really hoping you 
guys can get out a version for it soon.

Original issue reported on code.google.com by [email protected] on 14 Jul 2010 at 6:23

Patch for /_mssql.pyx

Line 432
#Please Try this change in the code for resolved this error 
"MSSQLDriverException("Connection to the database failed for an unknown 
reason." 

Original issue reported on code.google.com by [email protected] on 22 Apr 2011 at 4:13

Attachments:

problem instalation from the source on macosx10.6

What steps will reproduce the problem?
1. Download pymssql-1.9.908.zip 

2.  try to install using sudo python setup.py install in the source directory

the output is atached 

What version of the product are you using? On what operating system?
pymssql-1.9.908 on macosx 10.6 





Original issue reported on code.google.com by [email protected] on 14 Sep 2010 at 2:52

  • Merged into: #24

Attachments:

better handling for byte strings that don't represent ascii data

I have a test:

test_sqlalchemy:TestSA.test_pickle_type

that fails currently.  When this column is created, it is created as a 
varchar(50) column.  There is a note and monkey patch in:

sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql.dbapi

referring to the fact that pymssql does not have a Binary method.  I am a 
little over my head on this one as to what we need to do to fix it.  

Original issue reported on code.google.com by [email protected] on 15 Apr 2011 at 9:42

Possible issues with windows authentication support

What steps will reproduce the problem?
1. Attempt a connection via pymssql or _mssql

What is the expected output? What do you see instead?

The connection should be successful. Instead, an error of 
'_mssql.MssqlDriverException: Connection to the database failed for an unknown 
reason.' is reported to the console, and an error of 'Length specified in 
network packet payload did not match number of bytes read; the connection has 
been closed. Please contact the vendor of the client library.' is reported in 
the Event Viewer of the server.

What version of the product are you using? On what operating system?

1.0.2 on Windows Server 2008 R2

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 Oct 2010 at 4:48

need new releases on PYPI

What steps will reproduce the problem?
$ sudo easy_install pymssql
Searching for pymssql
Reading http://pypi.python.org/simple/pymssql/
Reading http://pymssql.sourceforge.net
Reading 
http://sourceforge.net/project/showfiles.php?group_id=40059&package_id=32202
Reading http://code.google.com/p/pymssql/
Reading http://code.google.com/p/pymssql/downloads/list
Best match: pymssql 1.9.908.win32
Downloading http://pymssql.googlecode.com/files/pymssql-1.9.908.win32.zip
Processing pymssql-1.9.908.win32.zip
error: Couldn't find a setup script in 
/tmp/easy_install-s3UIdY/pymssql-1.9.908.win32.zip

What version of the product are you using? On what operating system?
Kubuntu 10.04

Please provide any additional information below.
Maybe this is not correct place for this bug, then I hope you'll help me and 
tell where to post it. (I don't known much about easy_install)

Original issue reported on code.google.com by akimov.alex on 9 Jun 2010 at 7:32

Can't connect using pymssql 1.0.2 after upgrading FreeTDS from 0.64 to 0.83

What steps will reproduce the problem?
1. install pymssql 1.0.2 linked against FreeTDS 0.83
2.
>>> conn = pymssql.connect(database='DATABASE',
...                                          host='SERVER:PORT',
...                                          user='USER',
...                                          password='PASSWD')

What is the expected output? What do you see instead?

Expected prompt with no error.  Got this instead:

Traceback (most recent call last):
  File "<stdin>", line 4, in ?
  File "/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/pymssql-1.0.2-py2.4-solaris-2.10-i86pc.egg.new/pymssql.py", line 609, in connect
    raise InterfaceError, e[0]
pymssql.InterfaceError: Connection to the database failed for an unknown reason.

What version of the product are you using? On what operating system?

pymssql 1.0.2, FreeTDS 0.83, Solaris10/Intel.

Please provide any additional information below.

This worked with FreeTDS 0.64 but it's getting old and lots of bugs have
been fixed in FreeTDS since its release.  After adjusting the tds version
in the  freetds.conf file I can connect successfully using both the 0.64
and 0.83 versions of tsql.

Original issue reported on code.google.com by [email protected] on 5 Nov 2010 at 5:39

Cannot connect under windows, works fine in linux

What steps will reproduce the problem?
1. using 2.6 > try to connect under cmd line and get the 18456 state 1. nothing 
shows up other than user denied in the logs. 

What is the expected output? What do you see instead?
>>> conn = 
pymssql.connect(host=sqlhost,user=user,password=passwd,database=sqldatabase)
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    conn = pymssql.connect(host=sqlhost,user=user,password=passwd,database=sqldatabase)
  File "C:\Python26\lib\site-packages\pymssql.py", line 607, in connect
    raise OperationalError, e[0]
OperationalError: SQL Server message 18456, severity 14, state 1, line 0:
Login failed for user '*****'.

What version of the product are you using? On what operating system?
Windows XP, sp3 for both installs
archlinux

Please provide any additional information below.

I have tried on two different computers with the same results. one was in a vm 
which had a very basic install on it.

Original issue reported on code.google.com by [email protected] on 27 Nov 2010 at 7:48

Build failure version 1.9.908 on Windows XP

C:\pymssql-1.9.908>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\pymssql-1.9.908>cython --version
Cython version 0.13

C:\pymssql-1.9.908>python --version
Python 2.7.1

C:\pymssql-1.9.908>python setup.py build
running build
running build_ext
cythoning _mssql.pyx to _mssql.c

Error converting Pyrex file to C:
------------------------------------------------------------
...
DEF PYMSSQL_CHARSETBUFSIZE = 100
DEF MSSQLDB_MSGSIZE = 1024
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9

from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:33:0: 'python_version.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
DEF PYMSSQL_CHARSETBUFSIZE = 100
DEF MSSQLDB_MSGSIZE = 1024
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9

from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:33:0: 'PY_MAJOR_VERSION.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
DEF PYMSSQL_CHARSETBUFSIZE = 100
DEF MSSQLDB_MSGSIZE = 1024
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9

from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
                           ^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:33:28: Name 'PY_MAJOR_VERSION' not declared in mod
ule 'python_version'

Error converting Pyrex file to C:
------------------------------------------------------------
...
DEF PYMSSQL_CHARSETBUFSIZE = 100
DEF MSSQLDB_MSGSIZE = 1024
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9

from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:33:0: 'PY_MINOR_VERSION.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
DEF PYMSSQL_CHARSETBUFSIZE = 100
DEF MSSQLDB_MSGSIZE = 1024
DEF PYMSSQL_MSGSIZE = (MSSQLDB_MSGSIZE * 8)
DEF EXCOMM = 9

from python_version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
                                             ^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:33:46: Name 'PY_MINOR_VERSION' not declared in mod
ule 'python_version'

Error converting Pyrex file to C:
------------------------------------------------------------
...
    import uuid

import decimal
import datetime
from sqlfront cimport *
from stdio cimport fprintf, sprintf, FILE
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:41:0: 'stdio.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
    import uuid

import decimal
import datetime
from sqlfront cimport *
from stdio cimport fprintf, sprintf, FILE
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:41:0: 'fprintf.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
    import uuid

import decimal
import datetime
from sqlfront cimport *
from stdio cimport fprintf, sprintf, FILE
                  ^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:41:19: Name 'fprintf' not declared in module 'stdi
o'

Error converting Pyrex file to C:
------------------------------------------------------------
...
    import uuid

import decimal
import datetime
from sqlfront cimport *
from stdio cimport fprintf, sprintf, FILE
^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:41:0: 'sprintf.pxd' not found

Error converting Pyrex file to C:
------------------------------------------------------------
...
    import uuid

import decimal
import datetime
from sqlfront cimport *
from stdio cimport fprintf, sprintf, FILE
                           ^
------------------------------------------------------------

C:\pymssql-1.9.908\_mssql.pyx:41:28: Name 'sprintf' not declared in module 'stdi
o'

... etc, etc, the output is similar to the attachment 'output.txt' attached to 
Issue 23.
Thanks and regards,
Simon Haines.

Original issue reported on code.google.com by [email protected] on 6 Dec 2010 at 11:49

Intallation problem with head (r209) on linux

What steps will reproduce the problem?

1. Download the latest source from r209

2.  try to install using python setup.py install in the source directory

the output is atached 

What version of the product are you using? On what operating system?
latest revision r209 on linux 2.6.18-128.el5



Original issue reported on code.google.com by [email protected] on 4 Nov 2010 at 10:00

Attachments:

_mssql.c: No such file or directory

What steps will reproduce the problem?
1. Download pymssql-1.9.908.tar.gz
2. Try and build
3. Receive build error -> no _myssql.c
4. Pre-reqs are installed

What is the expected output? What do you see instead?
A clean build

What version of the product are you using? On what operating system?
1.9.908 on RedHat 2.6.9-67.ELsmp

Please provide any additional information below.
I've also tried this with an earlier source release 1.9.907 and the result
was the same.  Below is a snippet from the actual output:

sr/pkg/freetds/include -I/usr/local/include/python2.6 -c _mssql.c -o
build/temp.linux-i686-2.6/_mssql.o -DMSDBLIB
gcc: _mssql.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1

Below are the directory contents:

build         MANIFEST.in    pymssql.egg-info  setuptools-0.6c11-py2.6.egg
ChangeLog     _mssql.pxd     pymssql.pyx       sqlfront.pxd
ez_setup.py   _mssql.pyx     README            win32
ez_setup.pyc  nagios-plugin  setup.cfg
LICENSE       PKG-INFO       setup.py


Original issue reported on code.google.com by [email protected] on 29 Apr 2010 at 12:00

Feature Request: Option to return namedtuple (patch included)

Just watch R Hettinger's pycon video where he talks about namedtuple 
(collections.namedtuple)  It would be great if you added this as an option like 
'asdict'. 

Since you can build the dict, you have all the information to create a 
namedtuple.  
http://docs.python.org/library/collections.html#collections.namedtuple

There are a lot of pluses, like better memory usage like a regular tuple, plus 
self documenting.  We would get the best of both worlds of tuples and dicts.


Original issue reported on code.google.com by [email protected] on 25 Mar 2011 at 4:47

Make SQLAlchemy tests part of our testing process

Not sure how best to do this at this point, but if we can manage to run their 
tests, or most of their tests, against pymmssql, it should help us find/fix 
bugs.

Adding this to an automated test/build routine would be ideal.

Original issue reported on code.google.com by [email protected] on 12 Apr 2011 at 11:28

When pymssql.connect() with charset="cp949" on Windows, crash occurred.

What steps will reproduce the problem?
1. To refer issue 48, build pymssql for windows.
2. try to connect mssql server as below script.
import pymssql
conn = pymssql.connect(server="192.168.123.xxx",
                user="id", password="pw", database="db", charset="cp949")
cur = conn.cursor()
cur.execute("select * from mytable")
for row in cur:
    print row

What is the expected output? What do you see instead?
It is expected that contents of table is printed.
But, Python crash occurred.

What version of the product are you using? On what operating system?
revision ab786211a2cc, Cython 0.14.1, Python 2.6.6, Windows 7

Please provide any additional information below.
Above code work well with pymssql 1.0.2.
I try to trace the crash point and find that crash occurred at 491 line in 
_mssql.pyx.

        # Set the login timeout
        dbsetlogintime(login_timeout)

        # Connect to the server
        self.dbproc = dbopen(login, server)  ### << crash here.

        # Frees the login record, can be called immediately after dbopen.
        dbloginfree(login)

Below error message is displayed with charset="utf-8".

+++ _mssql.MSSQLConnection.__cinit__()
+++ _mssql.MSSQLConnection.__init__()

*** err_handler(dbproc = 025D30D8, severity = 9,  dberr = 20017, oserr = 0, 
dberrstr = 'Unexpected EOF from the server',  oserrstr = 'No error'); 
DBDEAD(dbproc) = 0
*** previous max severity = 0


*** err_handler(dbproc = 025D30D8, severity = 9,  dberr = 20002, oserr = 0, 
dberrstr = 'Adaptive Server connection failed',  oserrstr = 'No error'); 
DBDEAD(dbproc) = 1
*** previous max severity = 9

+++ _mssql.MSSQLConnection.__init__() -> dbopen() returned NULL
+++ _mssql.MSSQLConnection.__dealloc__()
+++ _mssql.MSSQLConnection.close()
Traceback (most recent call last):
  File "testpymssql.py", line 3, in <module>
    user="id", password="pw", database="db", charset="utf-8")
  File "pymssql.pyx", line 516, in pymssql.connect (pymssql.c:6644)
    raise OperationalError(e[0])
pymssql.OperationalError: (20017, '\xc4DB-Lib error message 20017, severity 
9:\nUnexpected EOF from the server\nDB-Lib error message 20002, severity 
9:\nAdaptive Server connection failed\n')

Original issue reported on code.google.com by [email protected] on 27 Apr 2011 at 5:50

Support Hostname, Port, TDS Version in connection options

It would be preferable to avoid the freetds.conf file altogether and to be able 
to set the port and TDS version.  My implementation and and tests are here:


https://bitbucket.org/rsyring/pymssql/changeset/4f53623a6308

which handles _mssql.connect() but pymssql.connect() would need to be adjusted 
to handle the extra params and pass them through too.

Original issue reported on code.google.com by [email protected] on 12 Apr 2011 at 6:23

import pymssql crashes python

What steps will reproduce the problem?
1. download newest pymssql for windows on this website
2. run the installer
3. try to import pymssql module, python crashes

What is the expected output? What do you see instead?
i expect it to not crash, python crashes

What version of the product are you using? On what operating system?
python2.6 on windows XP 2002SP3 32bit

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 21 Apr 2010 at 9:52

Connection to non-default instance fails

What steps will reproduce the problem?
1. Install Pymmsql 1.9.909-dev (trunk r201) or 1.9 packaged version
2. Attempt to connect to non-default instance, along the lines of:

pymssql.connect(r'server\some_instance',password='password',database='database',
user='user')

What is the expected output? What do you see instead?

Expect a connection to the non-default some_instance (because pymssql connects 
fine to the default instance).

What I get is:

  File "pymssql.pyx", line 507, in pymssql.connect (pymssql.c:6566)
    raise InterfaceError(e[0])
pymssql.InterfaceError: Connection to the database failed for an unknown reason.

What version of the product are you using? On what operating system?

Using 1.0.2+dfsg-1 on Ubuntu 10.04 64-bit, 1.9.908 on CentOS 5 64-bit(from 
source), and 1.9.909 (r201) on CentOS.


Original issue reported on code.google.com by graham.poulter on 13 Sep 2010 at 10:52

pymssql sets wrong hostname in login record

What steps will reproduce the problem?
1. connect to a database

What is the expected output? What do you see instead?
the hostname in an sp_who2 should show the client's hostname.  instead it shows 
the database server's.

What version of the product are you using? On what operating system?
1.0.2.  Confirmed bug in latest .pyx as well.

Please provide any additional information below.
http://www.freetds.org/reference/a00274.html#ga0

DBSETLHOST  (...)   
Set the (client) host name in the login packet.

Note: 'client' host.  .pyx code:

        DBSETLHOST(login, server);

that shouldn't be 'server' there.



Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 9:06

I can not connect the sql server 2005 on the windows server 2008

What steps will reproduce the problem?
1. When app conncet the database I found this problem.

What is the expected output? What do you see instead?
I want to connect the mssql 2005. But pymssql and _mssql did not work.
raise MSSQLDriverException("Connection to the database failed for an unknown 
reason.")

What version of the product are you using? On what operating system?
I am using python 2.6.5, pymssql-1.9.908.win32-py2.6.exe, mssql 2005 and 
windows server 2008.

Please provide any additional information below.
I try this in my local pc. The programm works good. My pc's stuff are win xp, 
mssql 2005, python 2.6.5 and pymssql-1.9.908.win32-py2.6.exe.

Original issue reported on code.google.com by [email protected] on 30 Aug 2010 at 2:27

Exception messages are corrupted

*What steps will reproduce the problem?*

Deliberately make a connection to a server that doesn't have a MSSQL server 
running or change the port to a wrong port.  However, you need to use a 
hostname that exists, or you will get a different error.

*What is the expected output?*

MSSQLDatabaseException: (20009, 'Net-Lib error during Connection refused')

*What do you see instead?*

MSSQLDatabaseException: (20009, '\xe8u\xbd*{\x7f')

I was also seeing:

Exception TypeError: 'an integer is required' in '_mssql.err_handler' ignored

come through to the terminal.

What version of the product are you using? On what operating system?

SVN / Ubuntu 10.04

Please provide any additional information below.

Looks like it is a problem with the way error strings are being copied into C 
variables.  My solution is here:

https://bitbucket.org/rsyring/pymssql/changeset/e68f2d8425ba

But, this is also related to issue 41.


Original issue reported on code.google.com by [email protected] on 12 Apr 2011 at 6:20

Pymssql mishandles bigint indexes greater than 24 bits.

What steps will reproduce the problem?
1. Create table "test_index" with one bigint column "id"
2. Execute SQL: insert into test_index (id) values (123456789)
3. Execute this python program:

import _mssql
conn = _mssql.connect(server=DB_Server, user=DB_user, password=DB_password, 
database=Database)
id = 123456789
print 'Selecting id = ', id
conn.execute_query('SELECT * FROM test_index WHERE id = %s', id)
for row in conn:
    print "ID=%s\n" % row['id']

What is the expected output?

LogSrv1$ ./try.py
Selecting id =  123456789
ID=123456789.0

What do you see instead?

LogSrv1$ ./try.py
Selecting id =  123456789
ID=123456792.0


What version of the product are you using? On what operating system?

/Python26/lib/site-packages/pymssql-1.9.905.1-py2.6.egg-info/
Microsoft Windows Server 2003 R2

Please provide any additional information below.

Thank you for looking at this and/or suggesting a workaround!

Original issue reported on code.google.com by [email protected] on 8 Jun 2010 at 4:39

tsql connects; pymssql does not.

I have a problem connecting to various MSSQL servers from one particular linux 
box (64bit Slackware, Python 2.7.1).

tsql works fine with either the servername (-S) or hostname (-H), but pymssql 
fails with one of two errors depending on whether or not I specify the port:

a) pymssql.connect(user='...', password='...', host='servername')
  `-> Adaptive Server is unavailable or does not exist
b) pymssql.connect(user='...', password='...', host='servername:port') # or "," 
rather than ":"
  `-> Unexpected EOF from the server


Using FreeTDS 0.82, pymssql 1.0.2

Original issue reported on code.google.com by [email protected] on 18 Jan 2011 at 12:51

Module use of python26.dll conflicts with this version of Python

import pymssql fails on Windows.

Python 2.6.5
python-mssql 1.0.2 (installed via easy_install for python 2.6)


...
    import pymssql
  File "...\eggs\pymssql-1.0.2-py2.6-win32.egg\pymssql.py", line 30, in <module>
  File "...\eggs\pymssql-1.0.2-py2.6-win32.egg\_mssql.py", line 7, in <module>
  File "...\eggs\pymssql-1.0.2-py2.6-win32.egg\_mssql.py", line 6, in __bootstrap__
ImportError: Module use of python26.dll conflicts with this version of Python.

Original issue reported on code.google.com by [email protected] on 30 Nov 2010 at 1:15

Co-ordinate with SQLAlchemy team on workarounds/limitations

SQLAlchemy is aware of limitations for 1.x branch:

http://www.sqlalchemy.org/docs/dialects/mssql.html#limitations

and their dialect classes actually enforce at least one of these (30 char 
identifiers).  We need to communicate with SA team and maybe even offer patches 
once we stabilize 2.0 code so that pymssql isn't artificially hindered by SA.

Original issue reported on code.google.com by [email protected] on 12 Apr 2011 at 11:07

Missing methods in pymssqlCursor (pymssqlCursor() is differ than pymssqlCnx.cursor()?)

What steps will reproduce the problem?
Execute Python code:
<code>
import pymssql

conn = pymssql.connect(host='localhost:3757', user='any', password='any', 
database='any', as_dict=True)
cur = pymssql.pymssqlCursor(conn, as_dict=True)
cur.execute("""select COLUMN_NAME, DATA_TYPE from INFORMATION_SCHEMA.COLUMNS
    where table_catalog = 'warehouse'    and table_name = 'account_doc'  order by ORDINAL_POSITION """)
conn.close()
</code>

Code above raises an exception:

File "C:\Python25\Lib\site-packages\pymssql.py", line 190, in execute
self._source.execute_query(operation)
AttributeError: pymssqlCnx instance has no attribute 'execute_query'

My environment is:
- Windows XP SP3
- Python 2.5.4
- pymssql 1.0.2

Regards
Jacek Kalucki

Original issue reported on code.google.com by [email protected] on 30 Jul 2010 at 8:58

error establishing connection with server with Windows Authentication option enabled

What steps will reproduce the problem?
1. Log in workstationn MS XP Pro Version 2002 SP3
2. Install Python 2.6.5
3. Install pymssql from pymssql-1.9.908.win32-py2.6.exe
4. Open python shell from cmd with command python
5. >>>import pymssql
6. test on MSSQL server with authentication required
7. conn = pymssql.connect(host=r'BBB-DB-TEST\BBBTEST', trusted=False, 
database='WH', user='usr', password='usrxx77')
8. works fine no error messages
9. test on MSSQL server with Windows Authentication mode
10. conn = = pymssql.connect(host=r'WIN-DB-TEST\WINTEST', trusted=True, 
database='FTGDB')
11. get message Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pymssql.pyx", line 456, in pymssql.connect (pymssql.c:6016)
    raise InterfaceError(e[0])
pymssql.InterfaceError: Connection to the database failed for an unknown reason.

What is the expected output? What do you see instead?
expected output: None, or no error messages
I've got instead:
--------------------------------
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pymssql.pyx", line 456, in pymssql.connect (pymssql.c:6016)
    raise InterfaceError(e[0])
pymssql.InterfaceError: Connection to the database failed for an unknown reason.
--------------------------------

What version of the product are you using? On what operating system?
- version: pymssql-1.9.908.win32-py2.6.exe
- OS: Windows XP Pro SP3

Please provide any additional information below.
- If I import pymssql or _mssql on IDLE shell it restarts. Command line python 
shell allows import these packages.
When tried to use _mssql instead of pymssql, gave same kind of errors.

also tried to make connection with following commands without success:
conn = = pymssql.connect(host=r'WIN-DB-TEST\WINTEST', trusted=True, 
database='FTGDB', user='', password='')
conn = = pymssql.connect(host=r'WIN-DB-TEST\WINTEST', trusted=True, 
database='FTGDB', user=None, password=None)

Original issue reported on code.google.com by [email protected] on 18 Aug 2010 at 2:44

feature: more detailed exceptions

When doing some debugging/testing, I noticed the following was output:

*** err_handler(dbproc = 0x22f28c0, severity = 9,  dberr = 20009, oserr = 111, 
dberrstr = 'Unable to connect: Adaptive Server is unavailable or does not 
exist',  oserrstr = 'Connection refused'); DBDEAD(dbproc) = 1
*** previous max severity = 0

This comes through to the Python developer as:

  File "_mssql.pyx", line 1349, in _mssql.maybe_raise_MSSQLDatabaseException (_mssql.c:12321)
    raise ex
MSSQLDatabaseException: (20009, 'Net-Lib error during Connection refused')

However, that message is pretty unhelpful to the python dev who doesn't 
understand the 20009 code/message is coming from TDS and/or doesn't know what 
to do with it.  

In order to make the messages less cryptic and more helpful, I would like to 
suggest making the string representation of a MSSQLException look something 
like:

DB: '<dberrstr>', OS: '<oserrstr>', tdscode: <dberr>, tdsmsg: '<dberr 
translation>'

So, the above exception would come through as:

MSSQLDatabaseException: DB: 'Unable to connect: Adaptive Server is unavailable 
or does not exist', OS: 'Connection refused', tdscode: 20009, tdsmsg: 'Net-Lib 
error during Connection refused'

Original issue reported on code.google.com by [email protected] on 12 Apr 2011 at 6:07

cannot connect to db from pymssql, can with tsql

What steps will reproduce the problem?
1.
import pymssql
conn = pymssql.connect(host='DEV', user='metashop_full', password='***', 
database='meta_full_test')
conn.close()
2.
$ tsql -S DEV -U metashop_full -D meta_full_test

What is the expected output? What do you see instead?
With tsql all is ok. From python got OperationalError: (18456, "Login failed 
for user 'metashop_full'.")

What version of the product are you using? On what operating system?
Mac OS X 10.5.8, pymssql SVN r230, freetds-0.82 (x86_64), Python 2.7


Please provide any additional information below.
See attached freetds logs

Original issue reported on code.google.com by [email protected] on 8 Feb 2011 at 10:51

Attachments:

Easy install issue: Couldn't find a setup script

I imagine the only problem is the naming of the file on the downloads page

What steps will reproduce the problem?
1. easy_install pymssql

What is the expected output? What do you see instead?
pymssql installed. Instead I see:
-% ./bin/easy_install pymssql
install_dir /Users/amukherjee/Documents/ua_checker/lib/python2.6/site-packages/
Searching for pymssql
Reading http://pypi.python.org/simple/pymssql/
Reading http://pymssql.sourceforge.net
Reading 
http://sourceforge.net/project/showfiles.php?group_id=40059&package_id=32202
Reading http://code.google.com/p/pymssql/
Reading http://code.google.com/p/pymssql/downloads/list
Best match: pymssql 1.9.908.win32
Downloading http://pymssql.googlecode.com/files/pymssql-1.9.908.win32.zip
Processing pymssql-1.9.908.win32.zip
error: Couldn't find a setup script in 
/var/folders/Hm/HmhB+KXdEIO2f4VqlTn+dk+++TI/-Tmp-/easy_install-SXKJGv/pymssql-1.
9.908.win32.zip


What version of the product are you using? On what operating system?
I'm using OS X 10.6.6 with python 2.6.1.

Please provide any additional information below.
Could you just try renaming the file pymssql-1.9.908.win32.zip to something 
like pymssql_installer-1.9.908.win32.zip or something like that? I have no 
proof that this'll fix it but it seems like it would...

Original issue reported on code.google.com by abhishek.mukher.g on 14 Feb 2011 at 3:14

  • Merged into: #6

VARCHAR type only retrieves the first 255 characters

What steps will reproduce the problem?
1. Query a table that has a varchar column defined with more than 255 
characters.

What is the expected output? 
The entire string (up to 8000 characters according to MSSQL specs) that is 
stored in the varchar column.

What do you see instead?
I only see the first 255 characters.

What version of the product are you using? On what operating system?
pymssql-1.9.908.win32-py2.6.exe (Windows xp with SQL Server 2005)

Please provide any additional information below.
I'm not sure if this is like this by design, but I'm pretty certain SQL Server 
2005+ supports up to 8000 characters in varchar fields. I don't have access to 
a SQL 2000 server.

Source: http://msdn.microsoft.com/en-us/library/ms176089.aspx


Original issue reported on code.google.com by [email protected] on 24 Jun 2010 at 9:16

rowcount does not work

I have just tried on Linux with pymssql-1.9.908 the following script:

from pymssql import connect

CREATE = 'CREATE TABLE foo(i INTEGER PRIMARY KEY, t VARCHAR(100))'
DROP = 'DROP TABLE foo'
INSERT = 'INSERT INTO foo VALUES (%d, %s)'
UPDATE = 'UPDATE foo SET t=%s WHERE i=%d'
SELECT = 'SELECT * FROM foo'
DELETE = 'DELETE FROM foo'

def main():
    conn = connect('itdbserver2', 'python', 'p1tone', 'data_manag')
    curs = conn.cursor()
    curs.execute(CREATE)
    try:
        curs.execute(INSERT, (1, 'line1'))
        print 'INSERT', curs.rowcount
        curs.execute(UPDATE, ('*line1*', 1))
        print 'UPDATE', curs.rowcount
        curs.execute(SELECT)
        print curs.fetchall()
        print 'SELECT', curs.rowcount
        curs.execute(DELETE)
        print 'DELETE', curs.rowcount
    finally:
        curs.execute(DROP)

I get:

INSERT 0
UPDATE 0
[(1, '*line1*')]
SELECT 1
DELETE 0

In other words, the rowcount after INSERT, UPDATE and DELETE is always 0
and this is wrong :-(

Original issue reported on code.google.com by [email protected] on 1 Jul 2010 at 9:22

Build failures on Windows XP 64-bit

> python  setup.py install
running install

running build

running build_ext

extracting FreeTDS

cythoning _mssql.pyx to _mssql.c

building '_mssql' extension

creating build

creating build\temp.win-amd64-2.6

creating build\temp.win-amd64-2.6\Release

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c 
/nologo /Ox /MD /W3 /GS- /DNDEBUG -Iwin32\freetds\include -Ic:\python26\include 
-Ic:\python26\PC /Tc_mssql.c /Fobuild\temp.win-amd64-2.6\Release\_mssql.obj 
-DMSDBLIB

_mssql.c

_mssql.c(643) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(663) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(685) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(712) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(6192) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', 
possible loss of data

_mssql.c(9967) : warning C4267: '=' : conversion from 'size_t' to 'int', 
possible loss of data

c:\documents and settings\apy\local 
settings\temp\tmp8f1jrn\pymssql-1.9.908\_mssql.c(4652) : warning C4700: 
uninitialized local variable '__pyx_v_dbcol' used

creating build\lib.win-amd64-2.6

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL 
/nologo /INCREMENTAL:NO /LIBPATH:win32\freetds\lib /LIBPATH:c:\python26\libs 
/LIBPATH:c:\python26\PCbuild\amd64 msvcrt.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib ws2_32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libTDS.lib dblib.lib 
/EXPORT:init_mssql build\temp.win-amd64-2.6\Release\_mssql.obj 
/OUT:build\lib.win-amd64-2.6\_mssql.pyd 
/IMPLIB:build\temp.win-amd64-2.6\Release\_mssql.lib 
/MANIFESTFILE:build\temp.win-amd64-2.6\Release\_mssql.pyd.manifest

_mssql.obj : warning LNK4197: export 'init_mssql' specified multiple times; 
using first specification

   Creating library build\temp.win-amd64-2.6\Release\_mssql.lib and object build\temp.win-amd64-2.6\Release\_mssql.exp

_mssql.obj : error LNK2019: unresolved external symbol dbsqlexec referenced in 
function __pyx_f_6_mssql_db_sqlexec

_mssql.obj : error LNK2019: unresolved external symbol dbadata referenced in 
function __pyx_f_6_mssql_get_data

_mssql.obj : error LNK2019: unresolved external symbol dbdata referenced in 
function __pyx_f_6_mssql_get_data

_mssql.obj : error LNK2019: unresolved external symbol dbalttype referenced in 
function __pyx_f_6_mssql_get_type

_mssql.obj : error LNK2019: unresolved external symbol dbcoltype referenced in 
function __pyx_f_6_mssql_get_type

_mssql.obj : error LNK2019: unresolved external symbol dbadlen referenced in 
function __pyx_f_6_mssql_get_length

_mssql.obj : error LNK2019: unresolved external symbol dbdatlen referenced in 
function __pyx_f_6_mssql_get_length

_mssql.obj : error LNK2019: unresolved external symbol dbcancel referenced in 
function __pyx_f_6_mssql_db_cancel

_mssql.obj : error LNK2019: unresolved external symbol dbtds referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_11tds_version___get__

_mssql.obj : error LNK2019: unresolved external symbol dbclose referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_close

_mssql.obj : error LNK2019: unresolved external symbol dbuse referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_select_db

_mssql.obj : error LNK2019: unresolved external symbol dbgetmaxprocs referenced 
in function __pyx_pf_6_mssql_get_max_connections

_mssql.obj : error LNK2019: unresolved external symbol dbcount referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_scalar

_mssql.obj : error LNK2019: unresolved external symbol dbnextrow referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_scalar

_mssql.obj : error LNK2019: unresolved external symbol dbsettime referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_13query_timeout___set__

_mssql.obj : error LNK2019: unresolved external symbol dbcmd referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbloginfree referenced 
in function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol tdsdbopen referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbsetlogintime 
referenced in function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbsetlname referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dblogin referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbdatecrack referenced 
in function __pyx_f_6_mssql_15MSSQLConnection_convert_db_value

_mssql.obj : error LNK2019: unresolved external symbol dbconvert referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_convert_db_value

_mssql.obj : error LNK2019: unresolved external symbol dbresults referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_non_query

_mssql.obj : error LNK2019: unresolved external symbol dbrpcinit referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure___init__

_mssql.obj : error LNK2019: unresolved external symbol dbrpcparam referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_bind

_mssql.obj : error LNK2019: unresolved external symbol dbretstatus referenced 
in function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretdata referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretlen referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretname referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbrettype referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbnumrets referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbsqlok referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbrpcsend referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbsetmaxprocs referenced 
in function __pyx_pf_6_mssql_set_max_connections

_mssql.obj : error LNK2019: unresolved external symbol dbmsghandle referenced 
in function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dberrhandle referenced 
in function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dbinit referenced in 
function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dbcolname referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_get_result

_mssql.obj : error LNK2019: unresolved external symbol dbnumcols referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_get_result

build\lib.win-amd64-2.6\_mssql.pyd : fatal error LNK1120: 40 unresolved 
externals

error: command '"C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

Traceback (most recent call last):
  File "f:\as\pypm\pypm-trunk\src\pypm\builder\mason.py", line 82, in build_package
    buildlog, bpkg, wrkdir, pyenv)
  File "f:\as\pypm\pypm-trunk\src\pypm\builder\mason.py", line 160, in _build
    raise SetupPyBuildFailed(e)
SetupPyBuildFailed: [SetupPyBuildFailed] non-zero returncode: 1
command: c:\python26\Python.exe setup.py install --no-compile 
--root=_pypm_install_root
pwd: c:\docume~1\apy\locals~1\temp\tmp8f1jrn\pymssql-1.9.908
stderr:

stdout:
running install

running build

running build_ext

extracting FreeTDS

cythoning _mssql.pyx to _mssql.c

building '_mssql' extension

creating build

creating build\temp.win-amd64-2.6

creating build\temp.win-amd64-2.6\Release

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c 
/nologo /Ox /MD /W3 /GS- /DNDEBUG -Iwin32\freetds\include -Ic:\python26\include 
-Ic:\python26\PC /Tc_mssql.c /Fobuild\temp.win-amd64-2.6\Release\_mssql.obj 
-DMSDBLIB

_mssql.c

_mssql.c(643) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(663) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(685) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(712) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data

_mssql.c(6192) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', 
possible loss of data

_mssql.c(9967) : warning C4267: '=' : conversion from 'size_t' to 'int', 
possible loss of data

c:\documents and settings\apy\local 
settings\temp\tmp8f1jrn\pymssql-1.9.908\_mssql.c(4652) : warning C4700: 
uninitialized local variable '__pyx_v_dbcol' used

creating build\lib.win-amd64-2.6

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL 
/nologo /INCREMENTAL:NO /LIBPATH:win32\freetds\lib /LIBPATH:c:\python26\libs 
/LIBPATH:c:\python26\PCbuild\amd64 msvcrt.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib ws2_32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libTDS.lib dblib.lib 
/EXPORT:init_mssql build\temp.win-amd64-2.6\Release\_mssql.obj 
/OUT:build\lib.win-amd64-2.6\_mssql.pyd 
/IMPLIB:build\temp.win-amd64-2.6\Release\_mssql.lib 
/MANIFESTFILE:build\temp.win-amd64-2.6\Release\_mssql.pyd.manifest

_mssql.obj : warning LNK4197: export 'init_mssql' specified multiple times; 
using first specification

   Creating library build\temp.win-amd64-2.6\Release\_mssql.lib and object build\temp.win-amd64-2.6\Release\_mssql.exp

_mssql.obj : error LNK2019: unresolved external symbol dbsqlexec referenced in 
function __pyx_f_6_mssql_db_sqlexec

_mssql.obj : error LNK2019: unresolved external symbol dbadata referenced in 
function __pyx_f_6_mssql_get_data

_mssql.obj : error LNK2019: unresolved external symbol dbdata referenced in 
function __pyx_f_6_mssql_get_data

_mssql.obj : error LNK2019: unresolved external symbol dbalttype referenced in 
function __pyx_f_6_mssql_get_type

_mssql.obj : error LNK2019: unresolved external symbol dbcoltype referenced in 
function __pyx_f_6_mssql_get_type

_mssql.obj : error LNK2019: unresolved external symbol dbadlen referenced in 
function __pyx_f_6_mssql_get_length

_mssql.obj : error LNK2019: unresolved external symbol dbdatlen referenced in 
function __pyx_f_6_mssql_get_length

_mssql.obj : error LNK2019: unresolved external symbol dbcancel referenced in 
function __pyx_f_6_mssql_db_cancel

_mssql.obj : error LNK2019: unresolved external symbol dbtds referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_11tds_version___get__

_mssql.obj : error LNK2019: unresolved external symbol dbclose referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_close

_mssql.obj : error LNK2019: unresolved external symbol dbuse referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_select_db

_mssql.obj : error LNK2019: unresolved external symbol dbgetmaxprocs referenced 
in function __pyx_pf_6_mssql_get_max_connections

_mssql.obj : error LNK2019: unresolved external symbol dbcount referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_scalar

_mssql.obj : error LNK2019: unresolved external symbol dbnextrow referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_scalar

_mssql.obj : error LNK2019: unresolved external symbol dbsettime referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_13query_timeout___set__

_mssql.obj : error LNK2019: unresolved external symbol dbcmd referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbloginfree referenced 
in function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol tdsdbopen referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbsetlogintime 
referenced in function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbsetlname referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dblogin referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection___init__

_mssql.obj : error LNK2019: unresolved external symbol dbdatecrack referenced 
in function __pyx_f_6_mssql_15MSSQLConnection_convert_db_value

_mssql.obj : error LNK2019: unresolved external symbol dbconvert referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_convert_db_value

_mssql.obj : error LNK2019: unresolved external symbol dbresults referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_execute_non_query

_mssql.obj : error LNK2019: unresolved external symbol dbrpcinit referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure___init__

_mssql.obj : error LNK2019: unresolved external symbol dbrpcparam referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_bind

_mssql.obj : error LNK2019: unresolved external symbol dbretstatus referenced 
in function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretdata referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretlen referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbretname referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbrettype referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbnumrets referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbsqlok referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbrpcsend referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProcedure_execute

_mssql.obj : error LNK2019: unresolved external symbol dbsetmaxprocs referenced 
in function __pyx_pf_6_mssql_set_max_connections

_mssql.obj : error LNK2019: unresolved external symbol dbmsghandle referenced 
in function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dberrhandle referenced 
in function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dbinit referenced in 
function __pyx_f_6_mssql_init_mssql

_mssql.obj : error LNK2019: unresolved external symbol dbcolname referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_get_result

_mssql.obj : error LNK2019: unresolved external symbol dbnumcols referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_get_result

build\lib.win-amd64-2.6\_mssql.pyd : fatal error LNK1120: 40 unresolved 
externals

error: command '"C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

Original issue reported on code.google.com by [email protected] on 10 Jul 2010 at 12:21

Import of pymssql on Centos fails to find libsydbd.so.5

What steps will reproduce the problem?
1. Build from current source 1.9.908
2. import pymssql;


What is the expected output? What do you see instead?

Python 2.6.5 (r265:79063, May 14 2010, 12:02:51) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: libsybdb.so.5: cannot open shared object file: No such file or 
directory


What version of the product are you using? On what operating system?
1.9.908
CentOS release 5.4 (Final)
Linux centreon 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT 2010 
x86_64 x86_64 x86_64 GNU/Linux


Please provide any additional information below.

This is for python2.6 which was built from source using the make altinstall 
build command so that it may live side by side with the default 2.4 that 
comes with CentOs.  That seems to work fine as other modules can be 
imported without error.

Tried to follow the README to build pymssql but it seems incomplete.  Ran  
/path/to/python2.6 setup.py build.  README suggests there should be a tests 
directory that does not see to be created.  Then ran /path/to/python2.6 
setup.py install.  This seems to place the files in the correct location 
for that build.

It appears that although setup.py looks in the /usr/local/lib dir as part 
of the include process, it's not being honored.  A symbolic link to 
/usr/lib64 for /usr/local/lib/libsybdb.so.5 corrects the issue.

Original issue reported on code.google.com by [email protected] on 14 May 2010 at 11:57

FetchAll fails to return rows when running against a connection instantiated with as_dict=True.

Reproduction Steps:
1. Open a connection with as_dict = True.
2. Open a cursor and run a select query.
3. Attempt to return rows using cursor.fetchall().

The fetchone() routine works without a hitch, so there doesn't seem to be an 
issue in collecting the data, just in how it's being returned from the 
fetchall() command. Both fetchone and fetchall work fine on non-dict 
connections.

I'm using Python 2.6.5, with xi's new build of pymssql (with the FreeTDS 
nightly), so I'm not sure if this is an issue related to that specific build, 
or the new version of pymssql. (I can't test the "official" build, since 
importing pymssql crashes python.) 

I'm running against SQL Server 2005 on Windows Server 2008.

Original issue reported on code.google.com by eavesdown on 24 Aug 2010 at 9:57

pip install (with setuptools) fails with "_mssql.c: No such file or directory" because Cython of .pyx files is skipped

What steps will reproduce the problem?
1. Install distribute or pip.
2. Try to install pymssql from source, e.g. "pip install 

What is the expected output? What do you see instead?

Expected: pymssql installs.

Actual: Cython is not declared as a dependency.  Even installing Cython first, 
it is not possible to install the package in the standard way, for example:

% pip install -e 'svn+http://pymssql.googlecode.com/svn/trunk/#egg=pymssql'
Obtaining pymssql from svn+http://pymssql.googlecode.com/svn/trunk/#egg=pymssql
  Checking out http://pymssql.googlecode.com/svn/trunk/ to ./src/pymssql
  Running setup.py egg_info for package pymssql
Installing collected packages: pymssql
  Running setup.py develop for pymssql
    building '_mssql' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/sw/include -I/usr/local/include -I/usr/local/include/freetds -I/usr/include -I/usr/include/freetds -I/usr/include/freetds_mssql -I/usr/local/freetds/include -I/usr/pkg/freetds/include -I/opt/local/include -I/opt/local/include/freetds -I/opt/local/freetds/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mssql.c -o build/temp.macosx-10.6-universal-2.6/_mssql.o -DMSDBLIB
    i686-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory
    i686-apple-darwin10-gcc-4.2.1: no input files
    powerpc-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory
    powerpc-apple-darwin10-gcc-4.2.1: no input files
    i686-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory
    i686-apple-darwin10-gcc-4.2.1: no input files
    lipo: can't figure out the architecture type of: /var/folders/ba/baPca9ytH-GnVrznlTbWPE+++TI/-Tmp-//ccocTSiN.out
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/nicholas/LMI/tail_table2/bin/python -c "import setuptools; __file__='/Users/nicholas/LMI/tail_table2/src/pymssql/setup.py'; execfile('/Users/nicholas/LMI/tail_table2/src/pymssql/setup.py')" develop --no-deps:
    running develop

running egg_info

writing pymssql.egg-info/PKG-INFO

writing top-level names to pymssql.egg-info/top_level.txt

writing dependency_links to pymssql.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

reading manifest template 'MANIFEST.in'

writing manifest file 'pymssql.egg-info/SOURCES.txt'

running build_ext

building '_mssql' extension

creating build

creating build/temp.macosx-10.6-universal-2.6

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall 
-Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe 
-I/sw/include -I/usr/local/include -I/usr/local/include/freetds -I/usr/include 
-I/usr/include/freetds -I/usr/include/freetds_mssql 
-I/usr/local/freetds/include -I/usr/pkg/freetds/include -I/opt/local/include 
-I/opt/local/include/freetds -I/opt/local/freetds/include 
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c 
_mssql.c -o build/temp.macosx-10.6-universal-2.6/_mssql.o -DMSDBLIB

i686-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory

i686-apple-darwin10-gcc-4.2.1: no input files

powerpc-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory

powerpc-apple-darwin10-gcc-4.2.1: no input files

i686-apple-darwin10-gcc-4.2.1: _mssql.c: No such file or directory

i686-apple-darwin10-gcc-4.2.1: no input files

lipo: can't figure out the architecture type of: 
/var/folders/ba/baPca9ytH-GnVrznlTbWPE+++TI/-Tmp-//ccocTSiN.out

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
Command /Users/nicholas/LMI/tail_table2/bin/python -c "import setuptools; 
__file__='/Users/nicholas/LMI/tail_table2/src/pymssql/setup.py'; 
execfile('/Users/nicholas/LMI/tail_table2/src/pymssql/setup.py')" develop 
--no-deps failed with error code 1
Storing complete log in /Users/nicholas/.pip/pip.log

What version of the product are you using? On what operating system?

Trunk or 1.9.908 on Mac OS X and Linux.

Please provide any additional information below.

This is separate from issue #6, which occurs because easy_install/pip download 
the Windows version rather than the source tarball.

Original issue reported on code.google.com by nriley on 3 Aug 2010 at 6:30

problem instalation from the source on macosx10.6

What steps will reproduce the problem?
1. Download pymssql-1.9.908.zip 

2.  try to install using sudo python setup.py install in the source directory

the output is atached 





What version of the product are you using? On what operating system?
pymssql-1.9.908 on macosx 10.6 





Original issue reported on code.google.com by [email protected] on 14 Sep 2010 at 2:51

  • Merged into: #24

Attachments:

Installation of pymssql on ubuntu fails compiling pymssql.pyx

What steps will reproduce the problem?
1. python setup.py install
2.
3.

What is the expected output? What do you see instead?
I expect to see pymssql compile and install.  All the prereq software is 
installed.  What I see is this:  see attachment



What version of the product are you using? On what operating system?
v 1.9.908, ubuntu 10.04 LTS the Lucid Lynx

Please provide any additional information below.



Original issue reported on code.google.com by jlowry%[email protected] on 14 Jan 2011 at 12:41

Attachments:

connection error with unknown reason on Windows

What steps will reproduce the problem?
1. install tdm-gcc 4.5.2 32bit version from http://tdm-gcc.tdragon.net/download
2. clone 7a55159b409b revision
3. modify setup.py as below
if sys.platform == 'win32':
    WINDOWS = True
    WIN32 = os.path.join(ROOT, 'win32')
    FREETDS = os.path.join(WIN32, 'freetds')
    include_dirs = [os.path.join(FREETDS, 'include')]
    library_dirs = [os.path.join(FREETDS, 'lib')]
    libraries = [
        #'libiconv', # <<< comment
        #'iconv', # <<< comment
        'sybdb',
        'ws2_32',
        'wsock32',
        'kernel32',
    ]
4. build and install the pymssql
python26 setup.py build -c mingw32 bdist_wininst

5. run the following script.
import pymssql
conn = pymssql.connect(server="myserver",
                user="myid", password="mypw", database="mydb")
cur = conn.cursor()
cur.execute("select * from mytable")

for row in cur:
    print row

What is the expected output? What do you see instead?
It is expected that contents of table is printed.
But, below error message occurred.

D:\prj\secu\TestWork\pymssql>python26 testpymssql.py
Traceback (most recent call last):
  File "testpymssql.py", line 4, in <module>
    user="tsaver", password="tsaveradmin", database="tsaver")
  File "pymssql.pyx", line 519, in pymssql.connect (pymssql.c:6697)
    raise InterfaceError(e[0])
pymssql.InterfaceError: Connection to the database failed for an unknown reason.

What version of the product are you using? On what operating system?
revision 7a55159b409b, Cython 0.14.1, Python 2.6.6, Windows 7

Please provide any additional information below.
Above script worked in CentOS 5.5 32bit well.
Also rev 237 build don't produce this issue on Windows.

Original issue reported on code.google.com by [email protected] on 18 Apr 2011 at 6:33

pymssql defaults to auto-commit=True

new connections opened with pymssql should probably execute "SET 
IMPLICIT_TRANSACTIONS ON;" before returning to the user.  this is to maintain 
compliance with the DB-API spec.

from http://www.python.org/dev/peps/pep-0249/:

"Note that if the database supports an auto-commit feature, this must be 
initially off.  An interface method may be provided to turn it back on."

>>> pymssql.__version__
'1.0.2'

Original issue reported on code.google.com by [email protected] on 11 Aug 2010 at 9:53

Build failed on Win7 x64

What steps will reproduce the problem?
1. python setup.py build on win7 x64 machine

What is the expected output? What do you see instead?
Here is the output that I am getting when I try to build pymssql:

running build
running build_ext
building '_mssql' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c 
/nologo /Ox /MD /W3 /GS- /DNDEBUG -Iwin32\free
tds\include -IC:\Python26\include -IC:\Python26\PC /Tc_mssql.c 
/Fobuild\temp.win-amd64-2.6\Release\_mssql.obj -DMSDBLIB
_mssql.c
_mssql.c(643) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data
_mssql.c(663) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data
_mssql.c(685) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data
_mssql.c(712) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 
'long', possible loss of data
_mssql.c(6192) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', 
possible loss of data
_mssql.c(9967) : warning C4267: '=' : conversion from 'size_t' to 'int', 
possible loss of data
c:\pythonmods\pymssql-1.9.908\_mssql.c(4652) : warning C4700: uninitialized 
local variable '__pyx_v_dbcol' used
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL 
/nologo /INCREMENTAL:NO /LIBPATH:win32\fre
etds\lib /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild\amd64 
msvcrt.lib kernel32.lib user32.lib gdi32.lib winsp
ool.lib ws2_32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
uuid.lib odbc32.lib odbccp32.lib libTDS.
lib dblib.lib /EXPORT:init_mssql build\temp.win-amd64-2.6\Release\_mssql.obj 
/OUT:build\lib.win-amd64-2.6\_mssql.pyd /IM
PLIB:build\temp.win-amd64-2.6\Release\_mssql.lib 
/MANIFESTFILE:build\temp.win-amd64-2.6\Release\_mssql.pyd.manifest
_mssql.obj : warning LNK4197: export 'init_mssql' specified multiple times; 
using first specification
   Creating library build\temp.win-amd64-2.6\Release\_mssql.lib and object build\temp.win-amd64-2.6\Release\_mssql.exp
_mssql.obj : error LNK2019: unresolved external symbol dbsqlexec referenced in 
function __pyx_f_6_mssql_db_sqlexec
_mssql.obj : error LNK2019: unresolved external symbol dbadata referenced in 
function __pyx_f_6_mssql_get_data
_mssql.obj : error LNK2019: unresolved external symbol dbdata referenced in 
function __pyx_f_6_mssql_get_data
_mssql.obj : error LNK2019: unresolved external symbol dbalttype referenced in 
function __pyx_f_6_mssql_get_type
_mssql.obj : error LNK2019: unresolved external symbol dbcoltype referenced in 
function __pyx_f_6_mssql_get_type
_mssql.obj : error LNK2019: unresolved external symbol dbadlen referenced in 
function __pyx_f_6_mssql_get_length
_mssql.obj : error LNK2019: unresolved external symbol dbdatlen referenced in 
function __pyx_f_6_mssql_get_length
_mssql.obj : error LNK2019: unresolved external symbol dbcancel referenced in 
function __pyx_f_6_mssql_db_cancel
_mssql.obj : error LNK2019: unresolved external symbol dbtds referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_1
1tds_version___get__
_mssql.obj : error LNK2019: unresolved external symbol dbclose referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection
_close
_mssql.obj : error LNK2019: unresolved external symbol dbuse referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection_s
elect_db
_mssql.obj : error LNK2019: unresolved external symbol dbgetmaxprocs referenced 
in function __pyx_pf_6_mssql_get_max_con
nections
_mssql.obj : error LNK2019: unresolved external symbol dbcount referenced in 
function __pyx_f_6_mssql_15MSSQLConnection_
execute_scalar
_mssql.obj : error LNK2019: unresolved external symbol dbnextrow referenced in 
function __pyx_f_6_mssql_15MSSQLConnectio
n_execute_scalar
_mssql.obj : error LNK2019: unresolved external symbol dbsettime referenced in 
function __pyx_pf_6_mssql_15MSSQLConnecti
on_13query_timeout___set__
_mssql.obj : error LNK2019: unresolved external symbol dbcmd referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection__
_init__
_mssql.obj : error LNK2019: unresolved external symbol dbloginfree referenced 
in function __pyx_pf_6_mssql_15MSSQLConnec
tion___init__
_mssql.obj : error LNK2019: unresolved external symbol tdsdbopen referenced in 
function __pyx_pf_6_mssql_15MSSQLConnecti
on___init__
_mssql.obj : error LNK2019: unresolved external symbol dbsetlogintime 
referenced in function __pyx_pf_6_mssql_15MSSQLCon
nection___init__
_mssql.obj : error LNK2019: unresolved external symbol dbsetlname referenced in 
function __pyx_pf_6_mssql_15MSSQLConnect
ion___init__
_mssql.obj : error LNK2019: unresolved external symbol dblogin referenced in 
function __pyx_pf_6_mssql_15MSSQLConnection
___init__
_mssql.obj : error LNK2019: unresolved external symbol dbdatecrack referenced 
in function __pyx_f_6_mssql_15MSSQLConnect
ion_convert_db_value
_mssql.obj : error LNK2019: unresolved external symbol dbconvert referenced in 
function __pyx_f_6_mssql_15MSSQLConnectio
n_convert_db_value
_mssql.obj : error LNK2019: unresolved external symbol dbresults referenced in 
function __pyx_f_6_mssql_15MSSQLConnectio
n_execute_non_query
_mssql.obj : error LNK2019: unresolved external symbol dbrpcinit referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure___init__
_mssql.obj : error LNK2019: unresolved external symbol dbrpcparam referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredP
rocedure_bind
_mssql.obj : error LNK2019: unresolved external symbol dbretstatus referenced 
in function __pyx_pf_6_mssql_20MSSQLStored
Procedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbretdata referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbretlen referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPro
cedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbretname referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbrettype referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbnumrets referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbsqlok referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredProc
edure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbrpcsend referenced in 
function __pyx_pf_6_mssql_20MSSQLStoredPr
ocedure_execute
_mssql.obj : error LNK2019: unresolved external symbol dbsetmaxprocs referenced 
in function __pyx_pf_6_mssql_set_max_con
nections
_mssql.obj : error LNK2019: unresolved external symbol dbmsghandle referenced 
in function __pyx_f_6_mssql_init_mssql
_mssql.obj : error LNK2019: unresolved external symbol dberrhandle referenced 
in function __pyx_f_6_mssql_init_mssql
_mssql.obj : error LNK2019: unresolved external symbol dbinit referenced in 
function __pyx_f_6_mssql_init_mssql
_mssql.obj : error LNK2019: unresolved external symbol dbcolname referenced in 
function __pyx_f_6_mssql_15MSSQLConnectio
n_get_result
_mssql.obj : error LNK2019: unresolved external symbol dbnumcols referenced in 
function __pyx_f_6_mssql_15MSSQLConnectio
n_get_result
build\lib.win-amd64-2.6\_mssql.pyd : fatal error LNK1120: 40 unresolved 
externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

What version of the product are you using? On what operating system?
python 2.6 and on Windows 7 x64

I did notice that there is a similar (or at least seems to be) issue with WinXP 
x64 (issue 11). There doesn't seem to be a solution to this problem there.  I'm 
just starting to learn python coming from the Perl world so any help is much 
appreciated! 

Thanks!


Original issue reported on code.google.com by [email protected] on 23 Aug 2010 at 8:00

  • Merged into: #11

Installation failure pymssql-1.9.908 Ubuntu server 10.04 LTS error message "ImportError: No module named ez_setup"

What steps will reproduce the problem?
1. From Ubuntu server 10.04 LTS fully patched run the following:
sudo su
# Python mssql (Microsoft SQL) module requirements
apt-get -y --force-yes install freetds-dev
# Python mssql module
cd /usr/local/src
wget http://pymssql.googlecode.com/files/pymssql-1.9.908.tar.gz
tar xvzf pymssql-1.9.908.tar.gz
cd pymssql-1.9.908/
python setup.py install
2. Recieve error:
 Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    import ez_setup
ImportError: No module named ez_setup

What is the expected output? What do you see instead?
Unknown expected other than successful install.

What version of the product are you using? On what operating system?
Product version: pymssql-1.9.908
OS: Ubuntu server 10.04.2 LTS

Please provide any additional information below.
I have had difficulty finding an error similar to this with this module.  
However, this "ez_setup" has been mentioned elsewhere in other python 
installation failures.

Original issue reported on code.google.com by [email protected] on 11 Feb 2011 at 3:04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.