Some of the information here may be outdated, please check the book instead
[edit]

Web2py binary distributions (for windows and mac) come packaged with python 2.5 which includes SQLIte3.

For legal reasons we do not distribute the drivers for MySQL, PostgreSQL, MSSQL, FireBird, DB2 and Oracle. In order to use these databases you need to run web2py from source, i.e.:

  • install Python 2.5
  • install mysqldb (for MySQL), psycopg2 (for PostgreSQL), cx_oracle (for Oracle), and/or pyodbc
  • download the web2py source
  • run with

    python2.5 web2py.py

  • moreover in your model you need to substitute the connection string

    db=SQLDB('sqlite://filename.db')

with (for MySQL)

 db=SQLDB('mysql://username:password@hostname:port/dbname')

or (for PostgreSQL)

 db=SQLDB('postgres://username:password@hostname:port/dbname')

or (for Oracle)

 db=SQLDB('oracle://username/password@dbname')

All those database backends in web2py support automatic transactions (for mysql we use InnoDB): commit on return, rollback on exception.

For a serious, scalable, production quality, modern database back-end we recommend PostgreSQL. That's what we run and we have stress-tested it quite extensively.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.