It's better when it's simple

User Tools

Site Tools


DataBase2 Plugin

Compatible with DokuWiki

Detritus, Hrun, Ponder Stibbons, Binky, Weatherwax, Adora Belle, Angua, Rincewind, Anteater, Lemming, 2009-02-14b, 2008-05-05

plugin Integrates DB-driven table featuring list and detail view, record editor, record-based locking for concurrent edit, file upload and more

Last updated on
Syntax, Admin
Conflicts with

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to database

Tagged with database, tables


On July 2017 this plugin was adopted by me with bless of the author “Thomas Urban”. Please also note the credits, taken from his homepage.

Current Features

Here is a short list of features included with this plugin:

  • local and remote database support
  • local databases are stored in current page's meta folder using SQLite1)
  • using PHP's PDO several remote database systems are basically supported (tested: MySQL)
  • integrate one table per tag from connected database.
  • list all records in a table featuring
  • limited number of records per page supporting flipping and page selection
  • sorting by single column ascendingly or descendingly
  • selecting subset of columns listed
  • selecting virtual fields aliasing computed data
  • filter listed records
  • multi-component filter supporting intersection and union
  • hard-coded definition for (initial) filter
  • optional filter controls - always available or requiring authorization to become available
  • select single record for detail view containing all available columns
  • included actions2)
  • adding new records
  • editing existing records
  • delete existing records
  • copy existing records
  • several value types (internally mapped into SQL types) having effect on record editor elements
  • text fields
  • checkboxes
  • enumeration selectors
  • image/file upload
  • “foreign keys”
  • single-record locking enabling several users concurrently work on a single table
  • table-, row- and column-related authorization rules for controlling access on supported actions
  • any performed action causing a change of data is logged in a separate table
  • provides extended access on data
  • exporting all or filtered records to CSV file
  • export table's change log to CSV for inspecting when someone has recently changed what in table
  • provides special print version listing all matching records in a vanilla document
  • read-only views using custom SELECT-statement
  • read-only integration of computed SQL terms
  • optionally supports DokuWiki markup in text values
  • console for administrative operations on locally managed SQLite databases


Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

To access remote databases, the plugin uses PDO. The appropriate drivers must be installed in the underlying operating-system, resp. PHP.


SELECT * FROM mytable


The plugin is integrated in a page by using a special tag called database2 like this:

<database2 tablename [attribute=value ...]>

column definition

column definition



The tag is surrounding a set of column definitions. Additionally the tag must contain a table's name to use in connected database and may contain further options. These options are called table options furtheron since every column may have individual options as well called column options throughout the rest of this documentation.

Here you find a complete definition and examples of the syntax.

Configuration and Settings

Enable ''database2''

On successfully installing plugin or upgrading from versions prior to 0.4.0 you need to enable the plugin on a per-page basis. Change to your wiki's configuration manager and look for the section related to plugin database2.

Enable on all pages

If your wiki isn't providing any open write access including wiki markup support and/or if you trust all your users you may globally enable database2 on every page using separate option in configuration manager. Doing so any patterns provided for selecting enabled pages are ignored.

Enable on selected pages

If global option described before is off, you may enter one or more patterns for matching pages' full path selecting those pages being enabled for using database2 tag. Write one pattern per line. Each pattern may be a PCRE pattern wrapped in slashes or a shell pattern with * and ? as wildcards.


Change Log

Known Bugs and Issues

:!: Plugins like discussion are used to enable unauthenticated users to post comments. As such posts may include any sort of Wiki markup. This way it's possible for commenters to embed database2 tags with public write access to databases into pages. Starting with 0.4.0 support for database2 must be enabled explicitly for selected pages of your Wiki. Now, it's possible to install both plugins. However you shouldn't have discussions on pages enabled for database2.

ToDo/Wish List

The following points are on my agenda:

  1. Remove option “wikistyle” and make it default and the only display mode. No one needs anything other.
  2. Render as normal Dokuwiki-table, using all provided classes to smoothly fits users template style.
  3. Default to render a table only, no extra functionality (pagers, filters, sorters, etc.). All those should come only after giving the appropriate option by syntax.
  4. Rework option parsing. Move all of it into syntax.php and parse the whole syntax on pagesave inside handle()-function. Currently only table options parsed and column options in a later pass.
  5. Hashing text input (e.g. for entering passwords)
  6. Adding missing columns/fields to a table

A DRAFT version of syntax



Recently they were stored in “namespace” and thus available for sharing by all pages in same namespace, however this association with namespaces was inconsistent and so changed to association with page. Sharing is still available by using explicit database selection in table option database.
available if table has a single integer column as primary key
plugin/database2.txt · Last modified: 2020-09-25 06:24 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki