Using Python native module in SDK ASE 16, the connection is sucessful import sybpydb conn = sybpydb.connect(servername='TEST',user='Myuser', password='Pa$$w0rd') cur = conn.cursor() cur.execute("select succod, sucdesc from mydb..tsucursal") while True: row = cur.fetchone() if (not row): break print("%s: %s" % (row[0], row[1])) else: print('Sucursal',row[0],'Descripcion',row[1]) cur.close() conn.close()
/*======================================================================================================*/ >From web2py, I am using 'mssql' intead of 'sybase' because sybase has not DSN attribute. db = DAL('mssql://DSN=SERVERTEST',check_reserved=['all']) <class 'pyodbc.ProgrammingError'> ('42000', "[42000] [SAP][ASE ODBC Driver][Adaptive Server Enterprise]Incorrect syntax near '('.\n (102) (SQLExecDirectW)") Version web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 Python Python 2.7.8: C:\Python27\python.exe (prefix: C:\Python27) Traceback Traceback (most recent call last): File "C:\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "C:\web2py\applications\StatusWeb\models\db.py", line 98, in <module> auth.define_tables(username=False, signature=False) File "C:\web2py\gluon\tools.py", line 2092, in define_tables super(Auth, self).define_tables(username, signature, migrate, fake_migrate)._table_signature_list File "C:\web2py\gluon\authapi.py", line 350, in define_tables format='%(first_name)s %(last_name)s (%(id)s)')) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 592, in define_table table = self.lazy_define_table(tablename, *fields, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 626, in lazy_define_table polymodel=polymodel) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 798, in create_table return self.migrator.create_table(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\migrator.py", line 281, in create_table self.adapter.create_sequence_and_triggers(query, table) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 881, in create_sequence_and_triggers self.execute(query) File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 67, in wrap return f(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 413, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) ProgrammingError: ('42000', "[42000] [SAP][ASE ODBC Driver][Adaptive Server Enterprise]Incorrect syntax near '('.\n (102) (SQLExecDirectW)") Error snapshot help <class 'pyodbc.ProgrammingError'>(('42000', "[42000] [SAP][ASE ODBC Driver][Adaptive Server Enterprise]Incorrect syntax near '('.\n (102) (SQLExecDirectW)")) inspect attributes Frames File C:\web2py\gluon\restricted.py in restricted at line 219 code arguments variables File C:\web2py\applications\StatusWeb\models\db.py in <module> at line 98 code arguments variables File C:\web2py\gluon\tools.py in define_tables at line 2092 code arguments variables File C:\web2py\gluon\authapi.py in define_tables at line 350 code arguments variables File C:\web2py\gluon\packages\dal\pydal\base.py in define_table at line 592 code arguments variables File C:\web2py\gluon\packages\dal\pydal\base.py in lazy_define_table at line 626 code arguments variables File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in create_table at line 798 code arguments variables File C:\web2py\gluon\packages\dal\pydal\migrator.py in create_table at line 281 code arguments variables File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in create_sequence_and_triggers at line 881 code arguments variables File C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py in wrap at line 67 code arguments variables File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in execute at line 413 code arguments variables Function argument list (self=<pydal.adapters.mssql.MSSQL1 object>, *args=('CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) NULL\n);',), **kwargs={}) Code listing def execute(self, *args, **kwargs): command = self.filter_sql_command(args[0]) handlers = self._build_handlers_for_execution() for handler in handlers: handler.before_execute(command) rv = self.cursor.execute(command, *args[1:], **kwargs) for handler in handlers: handler.after_execute(command) return rv Variables rv undefined self <pydal.adapters.mssql.MSSQL1 object> args ('CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) NULL\n);',) self.cursor <pyodbc.Cursor object> command 'CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) NULL\n);' self.cursor.execute <built-in method execute of pyodbc.Cursor object> kwargs {} locals request session response In file: C:\web2py\applications\StatusWeb\models\db.py <code object <module> at 000000000AC03D30, file "C:\web2py\applications\StatusWeb\models\db.py", line 7> Any suggestions? Best regards. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.