Search code examples
pythonweb.pymonetdb

monetdb with web.py (raise UnknownDB, dbn issue)


I tried using web.py framework to the monetdb.

This is my implementation code :

import web

render = web.template.render('templates/')
db       = web.database(dbn = 'monetdbd', user = 'monetdb', pw = 'monetdb', db = 'test')

urls = (
    '/','index'
)


class index:
    def GET(self,name):
        xSelect = db.select(x)
        return render.index(xSelect)

if __name__ == "__main__":
    app = web.application(urls,globals())
    app.run()

I have got the following error message while running python code.py

Traceback (most recent call last):
  File "code.py", line 4, in <module>
    db       = web.database(dbn = 'monetdbd', user = 'monetdb', pw = 'monetdb', db = 'test')
  File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/db.py", line 1145, in database
    raise UnknownDB, dbn
web.db.UnknownDB: monetdbd

The database server is running:

bmartis@bmartis-VirtualBox:~/Desktop/Monetdb/web$ ps ucx| grep -i monetdb
bmartis   2482  0.0  0.0  63956  2476 ?        Ssl  Jun29   0:33 monetdbd
bmartis@bmartis-VirtualBox:~/Desktop/Monetdb/web$

I don't understand what is wrong with db definition here. What's the right syntax or monetdb doesn't have a support for this?


Solution

  • It looks likes web2py doesn't support MonetDB at this moment. You can find a full list of the supported databases and required drivers in the Chapter 6 of the web2py Complete Reference Manual. As of today it looks like below:

    • SQLite - sqlite3 or pysqlite2 or zxJDBC (on Jython)
    • PostgreSQL - psycopg2 or pg8000 or zxJDBC (on Jython)
    • MySQL - pymysql or MySQLd
    • Oracle - cx_Oracle
    • MSSQL - pyodbc or pypyodbc
    • FireBird - kinterbasdb or fdb or pyodbc
    • DB2 - pyodbc
    • Informix - informixdb
    • Ingres - ingresdbi
    • Cubrid - cubriddb
    • Sybase - Sybase
    • Teradata - pyodbc
    • SAPDB - sapdb
    • MongoDB - pymongo
    • IMAP - imaplib