Summary: Query a odbc-SQL database server (MS-SQL) and display the results in a wiki page
Version: 2009-10-01
Prerequisites: a running odbc connection (FreeTDS), apche withh odbc module
Categories: Integration, Data
Discussion: OdbcPmWiki-Talk?


A module called odbcPmWiki that allows you to use SQL statements in a wiki page to query a odbcSQL database and display the results with a table.

Installation on Linux

  1. install and activate your odbc software
    unixODBC,freetds, php-odbc modules
  2. configure your ODBC-connect (the hardest work)
  3. test this connection with something like
echo "select * from dbo.ExchangeSRV_Prefs" | isql <dsn> <user> <passwd>

Add this script to your "local" directory:


Include it in config.php with:

$odbcPMWiki_dsn      = 'msdsn';
$odbcPMWiki_Username = 'user';
$odbcPMWiki_Password = 'secret';
$odbcPMWiki_TableFmt = 'class=\'tabtable\'';

explanation of the variables:

the DSN of the ODBC-Connection
username to access the ODBC-Connection
password to access the ODBC-Connection
formatting for the table tag (default is "border='1'")

The last variables is optional. All others must be set for odbcPmWiki to work.


This is a quick hack to access a MS-SQL from a Linux box. I created this receipt because the other ones where to complex and did not run in my installation. This is a transcription of the Receipt MyPmWiki from mySql to a odbc-Connection.


(:odbcPmWiki SQL statement:)


(:odbcPmWiki select * from dbo.ExchangeSRV_Prefs :)

Release notes

The first running Version

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

MyPmWiki, SelectQuery, DataQuery


JamesDavis, fraz, Mike


See discussion at OdbcPmWiki-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.