Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unix socket connection example #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sources/29-web2py-english/06.markmin
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ db = DAL('sqlite://storage.sqlite', pool_size=0)
**Google/NoSQL/NDB** | ``google:datastore+ndb``
-------------

To connect via unix socket, use a string like the following: ``postgres://username:password@/test?unix_socket=/path/to/socket``

Notice that in SQLite the database consists of a single file. If it does not exist, it is created. This file is locked every time it is accessed. In the case of MySQL, PostgreSQL, MSSQL, FireBird, Oracle, DB2, Ingres and Informix the database "test" must be created outside web2py. Once the connection is established, web2py will create, alter, and drop tables appropriately.

In the MySQL connection string, the ``?set_encoding=utf8mb4`` at the end sets the encoding to UTF-8 and avoids an ``Invalid utf8 character string:`` error on Unicode characters that consist of four bytes, as by default, MySQL can only handle Unicode characters that consist of one to three bytes. ``mathiasbyensbe``:cite
Expand Down Expand Up @@ -4880,4 +4882,4 @@ and some optional fields:
}
``

The exact specs are subject to change since this is a new feature.
The exact specs are subject to change since this is a new feature.