OdbcPmWiki

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
Status:
Maintainer:
Categories: Integration, Data
Discussion: OdbcPmWiki-Talk?

Solution

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)
    freetds.conf/odbcinst.ini/odbc.ini
  3. test this connection with something like
echo "select * from dbo.ExchangeSRV_Prefs" | isql <dsn> <user> <passwd>

Add this script to your "local" directory:

odbcpmwiki.phpΔ

Include it in config.php with:

$odbcPMWiki_dsn      = 'msdsn';
$odbcPMWiki_Username = 'user';
$odbcPMWiki_Password = 'secret';
$odbcPMWiki_TableFmt = 'class=\'tabtable\'';
include_once('cookbook/odbcpmwiki.php');

explanation of the variables:

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

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

Description

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.

Usage

(:odbcPmWiki SQL statement:)

Example

(:odbcPmWiki select * from dbo.ExchangeSRV_Prefs :)

Release notes

2009-10-01
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

Contributors

JamesDavis, fraz, Mike

Comments

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.