finally the solution is in this site:
http://linuxapuntes.blogspot.gr/2013/01/ms-access-desde-ubuntu-con-python-and.html
step 1 (install lib) :
>> sudo apt-get install mdbtools libmdbodbc1 pyodbc
step 2 create a template file and use the odbcinst -i -d -f templatefile to
add this to dobcinst.ini
>> sudo nano tempfile
and adding the followings:
[MDBTools]
Description=ODBC mdbtools driver for Access mdb
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so.1 #for x86_64
Server=locahost
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so.1 #for x86_64
Database=/path/to/mdb file
DBQ=/path/to/mdb/file
#Username=<user, if exist, otherwise just make comment this line>
#Password=<pas, if exist, otherwise just make comment this line
>>sudo odbcinst -i -d -f templatefile
step 3 make dsn :
>>sudo nano /usr/local/etc/odbc.ini
add the followings:
[MDBTools_dsn]
Description = Microsoft Access Try DB
Driver = MDBTools
Database = /path/to/mdb file
Servername = localhost
#Username = User
#Password = Password
step 4 check that works :
python
>>import pyodbc
>>cn=pyodbc.connect('DRIVER={MDBTools};SERVER=localhost;DBQ=/path/to/mdb;')
or
>>cn=pyodbc.connect('DSN=MDBTools_dsn')
>>c=cn.cursor()
>>c.execute('select * from tablename')
step 5 web2py :
add this to db.py :
db = DAL('mssql://DRIVER={MDBTools};SERVER=localhost;DBQ=/path/to/mdb;')
or
db = DAL('mssql://DSN=MDBTools_dsn')
The problem now :
if in controler i use
db.executesql('select * from tablename') everything is working perfect when
i use the grid=SQLFORM.grid(tb) there is an
Internal Server Error (apache2+wsgi) and the log :
Premature end of script headers: wsgihandler.py
can anybody help me to resolve this finall issue ?
--
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.