Google Groups

Re: How to use web2py DAL with sybase? Can we modify the adapter to use pyodbc?


dlypka May 22, 2012 3:29 AM
Posted in group: web2py-users
Our corporate standard OS is 32 bit Windows Vista.
The Sybase driver list at sourceforge.net is only for Windows XP which will not work.
I searched internet and it looks like the only good sybase driver is one that has to be purchased.
There is also one with source which has to be built but that needs the Sybase SDK which is very expensive.
Anyway, we have an ODBC driver installed and working  on our Vista machine.

So can we simply change dal.py to use odbc here?

i.e. will it work if we make this change?:

class SybaseAdapter(MSSQLAdapter):

    driver = globals().get('Sybase',None)

to 

    driver = globals().get('pyodbc',None)  <---------------------------------------------


Another temporary option is to take the 30 day trial driver from here:

Also note that we are using port forwarding and our database machine is very remote.
It is NOT the case that we have sybase installed locally on our laptop.

I also looked at the open source driver here
but even if we could somehow build it with the sybase SDK, I think it assumes sybase is installed locally.
Not sure if it can handle accessing a remote server.


Please advise.

Thanks.

On Wednesday, May 16, 2012 4:48:39 PM UTC-5, Massimo Di Pierro wrote:
I just committed a SybaseAdapter using this driver:


It extends the MSSQLAdapter but uses the other driver and Sybase types.
It needs testing.

You can use it with

DAL('sybase://dsnstring')

or

DAL('sybase://username:password@hostname:port/dbname')

It uses this line to built the dsn string:

   dsn = 'sybase:host=%s:%s;dbname=%s' % (host,port,db)

This is one line I am not sure about because the docs for the adapter do not explain it and I cannot try it.

Massimo





On Wednesday, 16 May 2012 16:24:02 UTC-5, dlypka wrote:
No preference on which python driver for sybase.
So whatever you select is fine with us.
Thanks.
- Dave Lypka.

On Wednesday, May 16, 2012 4:10:28 PM UTC-5, Massimo Di Pierro wrote:
Will send it tonight. Basically Sybase is almost the same as MSSQL. Do you a preference for one of the pyhton drivers for sybase?

On Wednesday, 16 May 2012 10:51:39 UTC-5, dlypka wrote:

I do not see any reference to "sybase" in 1.99.7 dal.py.

Please point me to the sybase adapter.

There are 2 of us developers here at work who can test it for you on a large corporate sybase database.

Thanks.

On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote:
web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority.



On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote:
I see this posting which has some sybase adapter code:

Is there anything else?

I have a need to use web2y + sybase at work.

Thanks.