Fullscreen
[Show/Hide Left Column]
[Show/Hide Right Column]

3d browser Print

Tags: dsn sql plugin

Admin DSN


Have you ever wished you could retrieve data that is actually in TikiWiki's (or some other) database, but not organized or displayed on-screen in the way you'd like? The SQL plugin can be used to display the results of SELECT queries in a Wiki page. The plugin displays the results of the query in an attractively formatted table.

To use the SQL plugin, you must do the following:
  1. Use Admin DSN to define the database to be used by the SQL plugin.
  2. Place a SQL plugin statement in a Wiki page. Please see PluginSQL for instructions.

This page page shows you how to define a DSN so that the SQL plugin can access external data.

Notes
This documentation was originaly based on Tikiwiki 1.7.5 but has been succesfully used for TikiWiki 2.2.

Usage

How to Define a DSN

1. On the main Tiki menu, click Admin (if necessary to show the options below this menu item).
1.a. Under the Admin menu in some versions of tikiwiki you can click a link to "Admin DSN" to go there directly.
1.b. In more recent versions (works in 2.2) you should click "Admin Home". At the bottom of the Admin Home page you will see "More Links" and in the Text area features area click the link to "DSN".

2. You'll see the Admin DSN page, shown here:


3. In the Name area, type a name for the external database you want to use. The name cannot contain spaces.

4. In the DSN area, type a valid DSN. See "DSN Syntax," below.

5. Click Save.

DSN Syntax


To define the DSN, you need to specify:
  • Database Type If you are using MySQL, the database type is mysql. If you are using Postgresql, the database type is "pgsql".
  • User Supply the name of the user that is qualified to access the database server.
  • Password Supply the password for the qualified user.
  • Database name Supply the name of the database that contains the desired data.

Here's the syntax:

1
DSN format: database-type://user:password@host/database-name


Tutorial


In this example we are creating a DSN for the database tiki in host localhost using the user root and the password seldon. The DSN will be named cosa (as in "Cosa Nostra").

Here's how the DSN looks:

1
mysql://root:seldon@localhost/tiki


Permissions


When a DSN is created with name foo the permission tiki_p_dsn_foo is automatically created. Only users with that permission can use the DSN to create a query or view the results of a query using that DSN. For more information on the permissions aspect of the SQL plugin, see PluginSQL.

In older versions of tikiwiki this permission needed to be added manually in the users_permissions table and the following syntax was suggested:
INSERT INTO users_permissions (permName, permDesc, level, type, admin) VALUES ('tiki_p_dsn_localhost', 'Can query localhost', 'dsn', '', '');

It should not be needed in more recent versions (certainly 2.2 and above) but if you do need to add the permission manually consider using the following, which also sets the permission type:
INSERT INTO users_permissions (permName, permDesc, level, type, admin) VALUES ('tiki_p_dsn_localhost', 'Can query localhost', 'dsn', 'dsn', '');


For more information
See PluginSQL to learn how to insert SQL queries in Wiki pages.


Contributors to this page: SEWilco674 points  , lindon1701 points  , AdamGriffiths15 points  , xavi26347 points  , marclaporte4510 Punkte  , jmj4 points  and system .
Page last modified on Wednesday 04 November, 2009 16:33:12 UTC by SEWilco674 points .

To register

To have an account at this site, please register at Tikiwiki.org (external link), and then use that user name and password to log in here.

Find by Page Name

Exact match

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki documentation and should correspond to development keywords (bug reports and feature requests):

Accessibility (WAI – 508)
Action log 2.x
Alert 3.x
Articles & Submissions
Backlinks
Banners
Blog
Bookmark
Browser Compatibility
Cache
Calendar
Category
Chat
Clean URLs
Comments
Communication Center
Compression (gzip)
Contacts Address book
Contact us
Content template
Contribution 2.x
Cookie
Copyright
Custom Home (and Groups Home Page)
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tikiwiki.org (Help System)
DogFood
Dynamic Content
Dynamic Variable
External Authentication
FAQ
Featured links
File Gallery
Forum
Friendship Network (Community)
Gmap Google maps
Groups
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interaction
Inter-User Messages
InterTiki
Karma
Live Support
Login
Look and Feel
Lost edit protection
Mail-in
Map with Mapserver
Menu
Meta Tags
Mobile Tiki and Voice Tiki
Mods
Module
MultiTiki
MyTiki
Newsletter
Notepad
Payment
Performance Speed / Load
Permissions
Platform independence (Linux-Apache, Windows/IIS, Mac, BSD)
Polls
Profile Manager
Quicktags
Quiz
Rating
Feeds
Score
Search engine optimization
Search
Security
Semantic links 3.x
Shadowbox
Shoutbox
Slideshow
Smarty Template
Smiley
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Stats
Surveys
System log
Tags 2.x
Task
Tell a Friend + Social Bookmarking 2.x
TikiTests 2.x
Theme
Trackers
TRIM
User Administration including registration and banning
User Files
User Menu
Watch
WebHelp
Webmail
Webservices
Wiki 3D
Wiki History, page rename, etc
Wiki Page Staging and Approval 2.x
Wiki Plugins extends basic syntax
Wiki Syntax
Wiki structure (book and table of content)
WYSIWYCA
WYSIWYG 2.x
XMLRPC