[web2py] Re: Connect to Sybase ASE 15.7
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']) ('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 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 (('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 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=, *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 args ('CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) NULL\n);',) self.cursor command 'CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) NULL\n);' self.cursor.execute kwargs {}
[web2py] Re: Connect to Sybase ASE 15.7
from error traceback seems like an error with database connection (Data source name not found and no default driver), for Data source name pls check you've already define it. if i'm not wrong in Control Panel > Administrative Tools > Data Source (ODBC), then restart web2py for no driver, perhaps you can install the sybase driver for python first, then restart web2py server best regards, stifan -- 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.
[web2py] Re: Connect to Sybase ASE 15.7
Hi!!! I get this message when try to connect at sybase (ASE) Ticket ID 127.0.0.1.2018-11-02.16-39-39.0e1ecf1e-e9a8-4950-893f-e3c2b7a98b0b Failure to connect, tried 5 times: Traceback (most recent call last): File "c:\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__ self._adapter = adapter(**kwargs) File "c:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 31, in __init__ driver_args, adapter_args, do_connect, after_connection) File "c:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "c:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 53, in __init__ self.reconnect() File "c:\web2py\gluon\packages\dal\pydal\connection.py", line 152, in reconnect self.connection = self.connector() File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 184, in connector return self.driver.connect(self.dsn, **self.driver_args) Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') Version web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 I made this test using: db = DAL('sybase://myuser:Pa$$w0rd@myserver/mydatabase',check_reserved=['all']) db = DAL('sybase://myuser:Pa$$w0rd@myserver:5000/mydatabase',check_reserved=['all']) db = DAL('sybase://myuser:Pa$$w0rd@/mydatabase',check_reserved=['all']) db = DAL('sybase://myuser:Pa$$w0rd@:5000/mydatabase',check_reserved=['all']) But in all case web2py show the same message. What is the problem?. Thanks in advance. -- 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.
[web2py] Re: Connect to Sybase ASE 15.7
Now issued another error type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File D:\programms\web2py\gluon\dal.py, line 8041, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File D:\programms\web2py\gluon\dal.py, line 700, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File D:\programms\web2py\gluon\dal.py, line 3852, in __init__ if do_connect: self.reconnect() File D:\programms\web2py\gluon\dal.py, line 659, in reconnect self.connection = f() File D:\programms\web2py\gluon\dal.py, line 3849, in connector return self.driver.connect(dsn, **driver_args) File D:\programms\web2py\gluon\Sybase.py, line 1401, in connect datetime, bulkcopy, locale, inputmap, outputmap) File D:\programms\web2py\gluon\Sybase.py, line 1035, in __init__ self.connect() File D:\programms\web2py\gluon\Sybase.py, line 1084, in connect status = conn.ct_connect(self.dsn) File D:\programms\web2py\gluon\Sybase.py, line 265, in _clientmsg_cb raise DatabaseError(msg) DatabaseError: Layer: 6, Origin: 8 ct_connect(): directory service layer: internal directory control layer error: Requested server name not found. If you establish a connection from the console python, the connection is established successfully import Sybase Sybase.connect('dibrera','user','password','dbname') Connection(16260352) вторник, 16 декабря 2014 г., 19:20:41 UTC+4 пользователь Leonel Câmara написал: In the DAL's SybaseAdapter if you change this line: driver_args.update(user = credential_decoder(user), password = credential_decoder(password)) to: driver_args.update(user = credential_decoder(user), passwd = credential_decoder(password)) Does it work? -- 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.
[web2py] Re: Connect to Sybase ASE 15.7
Which version of web2py are you using? I don't have the Sybase.py file in gluon. Have you split mssql.py ? Please post some code and add a print statement for the dns variable in SysbaseAdapter in order to understand what is going wrong. Paolo On Thursday, December 18, 2014 9:51:25 AM UTC+1, Anton Saltaev wrote: Now issued another error type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File D:\programms\web2py\gluon\dal.py, line 8041, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File D:\programms\web2py\gluon\dal.py, line 700, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File D:\programms\web2py\gluon\dal.py, line 3852, in __init__ if do_connect: self.reconnect() File D:\programms\web2py\gluon\dal.py, line 659, in reconnect self.connection = f() File D:\programms\web2py\gluon\dal.py, line 3849, in connector return self.driver.connect(dsn, **driver_args) File D:\programms\web2py\gluon\Sybase.py, line 1401, in connect datetime, bulkcopy, locale, inputmap, outputmap) File D:\programms\web2py\gluon\Sybase.py, line 1035, in __init__ self.connect() File D:\programms\web2py\gluon\Sybase.py, line 1084, in connect status = conn.ct_connect(self.dsn) File D:\programms\web2py\gluon\Sybase.py, line 265, in _clientmsg_cb raise DatabaseError(msg) DatabaseError: Layer: 6, Origin: 8 ct_connect(): directory service layer: internal directory control layer error: Requested server name not found. If you establish a connection from the console python, the connection is established successfully import Sybase Sybase.connect('dibrera','user','password','dbname') Connection(16260352) вторник, 16 декабря 2014 г., 19:20:41 UTC+4 пользователь Leonel Câmara написал: In the DAL's SybaseAdapter if you change this line: driver_args.update(user = credential_decoder(user), password = credential_decoder(password)) to: driver_args.update(user = credential_decoder(user), passwd = credential_decoder(password)) Does it work? -- 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.
[web2py] Re: Connect to Sybase ASE 15.7
Apart from the bug we have uncovered earlier, you now seem to have a sybase configuration problem, I don't use Sybase but this seems to be the common solution: http://www.tricksfind.in/2013/08/how-to-fix-sybase-error-requested.html -- 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.
[web2py] Re: Connect to Sybase ASE 15.7
In the DAL's SybaseAdapter if you change this line: driver_args.update(user = credential_decoder(user), password = credential_decoder(password)) to: driver_args.update(user = credential_decoder(user), passwd = credential_decoder(password)) Does it work? -- 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.