I have write an adapter making this addition in dal.py
line 116:
'msaccess://DRIVER={Microsoft Access Driver(*.mdb)};UID=user;PWD=pass;
DBQ=database
line 371:
try:
import odbtp
DRIVERS.append('MSACCESS(odbtp)')
LOGGER.warning('Msaccess with odbtp support is experimental')
except ImportError:
LOGGER.debug('no MSACCESS driver odbtp')
line 3758:
class MSACCESSAdapter(MSSQLAdapter):
"""inherit from MSSQLAdapter """
drivers = ('odbtp', )
def __init__(self, db, uri, pool_size=0, folder=None, db_codec='UTF-8',
credential_decoder=IDENTITY, driver_args={},
adapter_args={}, do_connect=True, srid=4326,
after_connection=None):
self.db = db
self.dbengine = "msaccess"
self.uri = uri
if do_connect: self.find_driver(adapter_args, uri)
self.pool_size = pool_size
self.folder = folder
self.db_codec = db_codec
self._after_connection = after_connection
self.srid = srid
self.find_or_make_work_folder()
# ## read: http://bytes.com/groups/python/460325-cx_oracle-utf8
self.REGEX_URI=
re.compile(r"""DRIVER=\{(?P<driver>[^}]+)\};SERVER=(?P<host>[\d\.]+);DBQ=(?P<db>[^;]+);UID=(?P<user>[^;]+);PWD=(?P<password>.+)""")
ruri = uri.split('://', 1)[1]
m = self.REGEX_URI.search(ruri).groupdict()
if not m:
raise SyntaxError("Invalid URI string in DAL: %s" % self.uri)
user = credential_decoder(m['user'])
if not user:
raise SyntaxError('User required')
password = credential_decoder(m['password'])
if not password:
password = ''
self.host = m['host']
if not self.host:
raise SyntaxError('Host name required')
db = m['db']
if not db:
raise SyntaxError('Database name required')
driver=m['driver']
if not driver:
raise SyntaxError('Driver is required')
self.cnxn = 'DRIVER={%s};SERVER=%s;DBQ=%s;UID=%s;PWD=%s' \
% (driver, self.host, db, user, password)
self.cnxn = 'DRIVER={%s};SERVER=%s;DBQ=%s;UID=%s;PWD=%s' \
% ('Microsoft Access Driver (*.mdb)', '192.168.1.182',
'c:\\v3.old.mdb', 'admin', 'incas')
def connector():
return self.driver.connect(self.cnxn,server=self.host)
self.connector = connector
if do_connect: self.reconnect()
The connection is working ok using DAL. If somebody can make a better
adapter please help.
I notice some problems:
1) when you make for example a typo error in your code (using controler
that need msaccess adapter) then there is no a ticket in web2py but a
"Internal Server Error"
2) using
*"A" server:*
SMP Sun Sep 23 11:00:33 UTC 2012 x86_64 GNU/Linux
Apache/2.2.16 (Debian)
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) (also in the same server
exist 2.4, 2.5)
ldd /usr/lib/apache2/modules/mod_wsgi.so
linux-gate.so.1 => (0xf76ed000)
libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0xf746f000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xf7456000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xf7451000)
libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xf744d000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xf7427000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xf72e0000)
libssl.so.0.9.8 => /usr/lib/i686/cmov/libssl.so.0.9.8 (0xf7294000)
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8
(0xf713b000)
libz.so.1 => /usr/lib/libz.so.1 (0xf7127000)
/lib/ld-linux.so.2 (0xf76ee000)
evrything is ok in console and in browser (apache2+wsgi)
when i use:
*"B" server*
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
Apache/2.2.22 (Debian)
Python 2.7.3 (default, Mar 13 2014, 11:03:55) (also exist 2.6, 3)
ldd /usr/lib/apache2/modules/mod_wsgi.so
linux-vdso.so.1 => (0x00007fffb43ff000)
libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0
(0x00007fdbe414a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007fdbe3f2e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdbe3d29000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1
(0x00007fdbe3b26000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdbe38a4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdbe3518000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fdbe3301000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007fdbe30eb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdbe489e000)
i have always "Internal Server Error" in browser *only when call a
controler using msaccess adapter* and everything is ok in console.
I can not find why but the problem maybe is the python version + wsgi. I
will try another server like "B" server" to clarify that the problem exist
and i will come back.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.