{"action":"created","issue":{"url":"https://api.github.com/repos/pymssql/pymssql/issues/339","labels_url":"https://api.github.com/repos/pymssql/pymssql/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/pymssql/pymssql/issues/339/comments","events_url":"https://api.github.com/repos/pymssql/pymssql/issues/339/events","html_url":"https://github.com/pymssql/pymssql/issues/339","id":98691331,"number":339,"title":"pymssql not working with Sybase SQL Anywhere (solution)","user":{"login":"LEALCorentin","id":11772537,"avatar_url":"https://avatars.githubusercontent.com/u/11772537?v=3","gravatar_id":"","url":"https://api.github.com/users/LEALCorentin","html_url":"https://github.com/LEALCorentin","followers_url":"https://api.github.com/users/LEALCorentin/followers","following_url":"https://api.github.com/users/LEALCorentin/following{/other_user}","gists_url":"https://api.github.com/users/LEALCorentin/gists{/gist_id}","starred_url":"https://api.github.com/users/LEALCorentin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LEALCorentin/subscriptions","organizations_url":"https://api.github.com/users/LEALCorentin/orgs","repos_url":"https://api.github.com/users/LEALCorentin/repos","events_url":"https://api.github.com/users/LEALCorentin/events{/privacy}","received_events_url":"https://api.github.com/users/LEALCorentin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pymssql/pymssql/labels/enhancement","name":"enhancement","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pymssql/pymssql/milestones/7","html_url":"https://github.com/pymssql/pymssql/milestones/Someday...Maybe","labels_url":"https://api.github.com/repos/pymssql/pymssql/milestones/7/labels","id":1366550,"number":7,"title":"Someday...Maybe","description":"For issues that are a good idea but just can't be addressed right now due to lack of maintainer bandwidth.  These are items the maintainers would want to pursue if we ever got a bunch of time on our hands to devote to pymssql.\r\n\r\nThe key here is that it's ok if it never gets done.","creator":{"login":"rsyring","id":109467,"avatar_url":"https://avatars.githubusercontent.com/u/109467?v=3","gravatar_id":"","url":"https://api.github.com/users/rsyring","html_url":"https://github.com/rsyring","followers_url":"https://api.github.com/users/rsyring/followers","following_url":"https://api.github.com/users/rsyring/following{/other_user}","gists_url":"https://api.github.com/users/rsyring/gists{/gist_id}","starred_url":"https://api.github.com/users/rsyring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsyring/subscriptions","organizations_url":"https://api.github.com/users/rsyring/orgs","repos_url":"https://api.github.com/users/rsyring/repos","events_url":"https://api.github.com/users/rsyring/events{/privacy}","received_events_url":"https://api.github.com/users/rsyring/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-10-20T15:47:39Z","updated_at":"2015-10-20T15:47:51Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-08-03T07:58:24Z","updated_at":"2015-10-21T16:05:58Z","closed_at":null,"body":"Hello,\r\n\r\nThis issue is half an issue half a suggestion.\r\n\r\nI founded unclear in the documentation is pymssql supposed to work for Sybase SQL Anywhere or not. As I needed to write a Python script and needed to connect to a Sybase database I had to find a library for it. The Sybase library for Python is no more maintained thus I used pymssql. After a long time trying it without any result I started analysing the code. I realised that, in fact, pymssql is not made for Sybase SQL Anywhere. And this can quite easily be changed.\r\nTo help you correct things properly (I haven't time to make it myself, sorry) I will explain you the problems and what to change. First to connect a Sybase SQL Anywhere database, it is needed to use FreeTDS version 5.0 and pymssql do not support it. Secondly, in Sybase the conn_properties parameter is not needed thus I needed to pass to the connection function an empty parameter to avoid the database to reject my connection. This worked perfectly for me using Debian but do not work with ArchLinux I can't find why...\r\n\r\nI join you a diff file I created to show you what are the main changes I made. I think it can be made a cleaner manner but you have the big idea.\r\n\r\n\r\n```\r\ndiff -rBu pymssql-2.1.1Old/_mssql.pyx pymssql-2.1.1New/_mssql.pyx\r\n--- pymssql-2.1.1Old/_mssql.pyx\t2014-11-25 02:55:04.000000000 +0100\r\n+++ pymssql-2.1.1New/_mssql.pyx\t2015-02-26 14:57:22.000000000 +0100\r\n@@ -34,6 +34,7 @@\r\n # Provide constants missing in FreeTDS 0.82 so that we can build against it\r\n DEF DBVERSION_71 = 5\r\n DEF DBVERSION_72 = 6\r\n+DEF DBVERSION_50 = 7\r\n \r\n ROW_FORMAT_TUPLE = 1\r\n ROW_FORMAT_DICT = 2\r\n@@ -515,7 +516,7 @@\r\n                 return 8.0  # Actually 7.1, return 8.0 to keep backward compatibility\r\n             elif version == 8:\r\n                 return 7.0\r\n-            elif version == 6:\r\n+            elif version == 7:\r\n                 return 5.0\r\n             elif version == 4:\r\n                 return 4.2\r\n@@ -1675,6 +1676,8 @@\r\n     \"\"\"\r\n     if verstr == u'4.2':\r\n         return DBVERSION_42\r\n+    if verstr == u'5.0':\r\n+        return DBVERSION_50\r\n     if verstr == u'7.0':\r\n         return DBVERSION_70\r\n     if verstr == u'7.1':\r\nSeulement dans pymssql-2.1.1New: _mssql.pyx~\r\ndiff -rBu pymssql-2.1.1Old/pymssql.pyx pymssql-2.1.1New/pymssql.pyx\r\n--- pymssql-2.1.1Old/pymssql.pyx\t2014-11-25 02:55:04.000000000 +0100\r\n+++ pymssql-2.1.1New/pymssql.pyx\t2015-02-26 15:00:56.000000000 +0100\r\n@@ -577,7 +577,7 @@\r\n \r\n def connect(server='.', user='', password='', database='', timeout=0,\r\n         login_timeout=60, charset='UTF-8', as_dict=False,\r\n-        host='', appname=None, port='1433', conn_properties=None, autocommit=False):\r\n+        host='', appname=None, port='1433', tds_version='5.0', conn_properties=None, autocommit=False):\r\n     \"\"\"\r\n     Constructor for creating a connection to the database. Returns a\r\n     Connection object.\r\n@@ -629,7 +629,7 @@\r\n     try:\r\n         conn = _mssql.connect(server=server, user=user, password=password,\r\n                               charset=charset, database=database,\r\n-                              appname=appname, port=port,\r\n+                              appname=appname, port=port, tds_version=tds_version,\r\n                               conn_properties=conn_properties)\r\n \r\n     except _mssql.MSSQLDatabaseException, e:\r\nSeulement dans pymssql-2.1.1New: pymssql.pyx~\r\ndiff -rBu pymssql-2.1.1Old/setup.py pymssql-2.1.1New/setup.py\r\n--- pymssql-2.1.1Old/setup.py\t2014-11-25 02:55:04.000000000 +0100\r\n+++ pymssql-2.1.1New/setup.py\t2015-04-02 17:39:38.000000000 +0200\r\n@@ -147,7 +147,8 @@\r\n compiler = ccompiler.new_compiler()\r\n \r\n _extra_compile_args = [\r\n-    '-DMSDBLIB'\r\n+    '-DMSDBLIB',\r\n+    '-std=c99'\r\n ]\r\n \r\n WINDOWS = False\r\n@@ -208,7 +209,7 @@\r\n             if compiler.has_function('clock_gettime', libraries=['rt']):\r\n                 libraries.append('rt')\r\n \r\n-usr_local = '/usr/local'\r\n+usr_local = '/usr'\r\n if osp.exists(usr_local):\r\n     add_dir_if_exists(\r\n         include_dirs,\r\n\r\n```\r\n\r\nThis diff is applied to the last release (2.1.1)\r\n\r\nIf you find the reason why it doesn't work on ArchLinux, please tell me I would be very grateful."},"comment":{"url":"https://api.github.com/repos/pymssql/pymssql/issues/comments/149945685","html_url":"https://github.com/pymssql/pymssql/issues/339#issuecomment-149945685","issue_url":"https://api.github.com/repos/pymssql/pymssql/issues/339","id":149945685,"user":{"login":"LEALCorentin","id":11772537,"avatar_url":"https://avatars.githubusercontent.com/u/11772537?v=3","gravatar_id":"","url":"https://api.github.com/users/LEALCorentin","html_url":"https://github.com/LEALCorentin","followers_url":"https://api.github.com/users/LEALCorentin/followers","following_url":"https://api.github.com/users/LEALCorentin/following{/other_user}","gists_url":"https://api.github.com/users/LEALCorentin/gists{/gist_id}","starred_url":"https://api.github.com/users/LEALCorentin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LEALCorentin/subscriptions","organizations_url":"https://api.github.com/users/LEALCorentin/orgs","repos_url":"https://api.github.com/users/LEALCorentin/repos","events_url":"https://api.github.com/users/LEALCorentin/events{/privacy}","received_events_url":"https://api.github.com/users/LEALCorentin/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T16:05:58Z","updated_at":"2015-10-21T16:05:58Z","body":"@rsyring http://www.sypron.nl/get_ase_soft.html\r\nThis may be what you're looking for. Please note that I didn't test it."}}