Tags:
create new tag
view all tags

SID-00739: Not able to use DatabasePlugin with DB2

Status: Answered Answered TWiki version: 4.3.2 Perl version: v5.8.5
Category: CategoryPlugins Server OS: GNU/Linux Last update: 15 years ago

Hello,

Does DatabasePlugin support DB2? If so, could you help me with what I am doing wrong?

I installed and enabled DatabasePlugin and DBD::DB2. Both TWiki and DB2 are hosted by the same server.

When testing DatabasePlugin on a TWiki page with the following syntax:

%DATABASE_SQL{description="WIKIS" sql="SELECT * from POLICY" format="| $ID $TITLE $MAXIMUM_SIZE |"}%

.... I get the following exception:

=DBI connect('database=dbi:DB2:WIKIS;host=myhost,'db2inst1',...) failed: [IBM][CLI Driver] SQL1013N The database alias name or database name "" could not be found. SQLSTATE=42705 at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin/Connection.pm line 31 at /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 598 DBI::__ANON__('undef', 'undef') called at /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 648 DBI::connect('DBI', 'DBI:DB2:database=dbi:DB2:WIKIS;host=9.123.241.90', 'db2inst1', 'passw0rd', 'HASH(0xa13cb34)') called at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin/Connection.pm line 31 TWiki::Plugins::DatabasePlugin::Connection::connect('TWiki::Plugins::DatabasePlugin::Connection=HASH(0x9714d6c)') called at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin/DATABASE_SQL.pm line 8 TWiki::Plugins::DatabasePlugin::DATABASE_SQL::handle('TWiki::Plugins::DatabasePlugin::Connection=HASH(0x9714d6c)', 'undef') called at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin.pm line 81 eval {...} called at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin.pm line 75 TWiki::Plugins::DatabasePlugin::_dispatch('DB2', 'undef') called at /opt/twiki/lib/TWiki/Plugins/DatabasePlugin.pm line 98 TWiki::Plugins::DatabasePlugin::commonTagsHandler(

My LocalSite.cfg looks as following:

$TWiki::cfg{Plugins}{DatabasePlugin}{Enabled} = 1;
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigSource} = 'Local';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigHost} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigDriver} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigDB} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigSID} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigTable} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigUsername} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigPassword} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{EditURLPrefix} = 'http';
$TWiki::cfg{Plugins}{DatabasePlugin}{EditURLPath} = 'myhost:50000/WIKIS';
# **PERL**
# <h2>Setup for Local databases table</h2>
# Table of configuration info for all the databases you might access.
# Used if {ConfigSource} is Local.
# This structure is an array of database definitions. Each database
# is defined using a hash where the fields of the array are:
# <ol>
# <li> description - Symbolic name for this database</li>
# <li> driver - DB driver - values like: mysql, Oracle, etc.</li>
# <li> hostname - DB host</li>
# <li> database - DB name</li>
# <li> sid - DB sid (Oracle, ignore for MySQL)</li>
# <li> username - DB username</li>
# <li> password - DB password</li>
# <li> table_name - optional table name, used with DATABASE_TABLE and DATABASE_REPEAT to predefine which table to look up
# </ol>
$TWiki::cfg{Plugins}{DatabasePlugin}{Databases} = [
                                                    {
                                                      'sid' => '',
                                                      'hostname' => 'myhost',
                                                      'description' => 'WIKIS',
                                                      'username' => 'db2inst1',
                                                      'database' => 'dbi:DB2:WIKIS',
                                                      'password' => 'passw0rd',
                                                      'table_name' => 'POLICY',
                                                      'driver' => 'DB2'
                                                    }
                                                  ];

Thanks!

-- DmitryRadinsky - 2010-02-04

Discussion and Answer

Getting the proper drivers for a particular DB engine installed and configured can be tricky. I once pulled my teeth on a MS SQL Server configuration. Not sure if of any help, here is the config I used for MS SQL:

$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigSource} = 'Local';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigHost} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigDriver} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigDB} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigSID} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigTable} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigUsername} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{ConfigPassword} = '';
$TWiki::cfg{Plugins}{DatabasePlugin}{EditURLPrefix} = 'https';
$TWiki::cfg{Plugins}{DatabasePlugin}{EditURLPath} = 'phpMyAdmin-2.2.2-rc1';
$TWiki::cfg{Plugins}{DatabasePlugin}{Databases} = [
{
 'hostname' => 'sql.example.com;port=1433;charset=windows-1252;tds version=8.0',
 'description' => 'ExampleData',
 'username' => 'example\twikisql',
 'database' => 'ExampleData',
 'password' => 'example',
 'table_name' => '',
 'driver' => 'Sybase'
}
];

It might be worthwhile asking in a DB2 forum.

-- PeterThoeny - 2010-02-05

Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the TWiki consultants if you need timely help. We invite you to get involved with the community, it is more likely you get community support if you support the open source project!

-- PeterThoeny - 2010-04-05

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Not able to use DatabasePlugin with DB2
SupportCategory CategoryPlugins
TWiki version 4.3.2
Server OS GNU/Linux
Web server Apache
Perl version v5.8.5
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2010-04-05 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.