Bug 870483

Summary: python-sybase + FreeTDS with MS SQL server: "sp_cursoropen: The value of the parameter 'scrollopt' is invalid."
Product: [Fedora] Fedora Reporter: Martin Wilck <martin.wilck>
Component: freetdsAssignee: Dmitry Butskoy <dmitry>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: dmitry
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: http://lists.ibiblio.org/pipermail/freetds/2012q4/028125.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-17 23:50:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
suggested patch none

Description Martin Wilck 2012-10-26 15:39:33 UTC
Created attachment 633939 [details]
suggested patch

Description of problem:
I have a problem using python-sybase with a MS-SQL Server data base (TDS 7.1).
cursor.execute() aborts with the error message 
"sp_cursoropen: The value of the parameter 'scrollopt' is invalid.".

Version-Release number of selected component (if applicable):
python-sybase-0.39-8.fc17
freetds-0.91-3.fc17

How reproducible:
always

Steps to Reproduce:
1. setup a connection to MS SQL server (TDS version 7.1)
2. use tsql to make sure freetds basic access workd
3. try to access with python-sybase
  
db=Sybase.connect("ServerName", "UID", "PWD")
c=db.cursor()
c.execute("SELECT ...")

Actual results:
"sp_cursoropen: The value of the parameter 'scrollopt' is invalid.".


Expected results:
SELECT works

Additional info:
I sent the attached patch to freetds.org.

The same problem has been reported a long time ago already:
https://sourceforge.net/mailarchive/forum.php?thread_name=5c06fa770907291200w5e7aeb3akaba12ab95d419785%40mail.gmail.com&forum_name=python-sybase-misc

As correctly stated there, the problem occurs with python-sybase v0.39 and
later only. This is due to the fact that python-sybase started to use
the ct_cursor() API in 0.39. But that's not a bug of python-sybase.

I analyzed the problem and I found that FreeTDS ctlib code sends a value
of 0 for cursor->type and cursor->concurrency to the server, which is
invalid. It appears that these two fields are never properly initialized
in ctlib. The ODBC code (odbc.c) has code that initializes these fields.

Comment 1 Dmitry Butskoy 2012-10-26 16:02:21 UTC
> I sent the attached patch to freetds.org.
http://lists.ibiblio.org/pipermail/freetds/2012q4/028125.html

Well, lets wait for upstream decision. Please, inform us if upstream apply this patch (or perform some another fixing of the issue), either in its testing or "freetds-patched" branch...

Comment 3 Dmitry Butskoy 2012-10-29 12:15:02 UTC
Fine.

Lets wait for actual appearing in CVS for 0.91

Comment 4 Martin Wilck 2012-10-31 17:46:17 UTC
FreeTDS doesn't use CVS any more.

Here are the upstream commits:

http://gitorious.org/freetds/freetds/commit/8bd39e7360fc70b89191df69f137297ee3578ab3 (HEAD)

http://gitorious.org/freetds/freetds/commit/f3ae29d975f3de4a2034d8ab7d340a308dce3c06 (0.91)

Comment 5 Fedora Update System 2012-11-07 17:51:16 UTC
freetds-0.91-5.gitf3ae29d.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/freetds-0.91-5.gitf3ae29d.fc18

Comment 6 Fedora Update System 2012-11-07 17:52:10 UTC
freetds-0.91-5.gitf3ae29d.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/freetds-0.91-5.gitf3ae29d.fc17

Comment 7 Fedora Update System 2012-11-08 02:00:11 UTC
Package freetds-0.91-5.gitf3ae29d.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing freetds-0.91-5.gitf3ae29d.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-17776/freetds-0.91-5.gitf3ae29d.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-11-17 23:50:26 UTC
freetds-0.91-5.gitf3ae29d.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.