ADSM-L

Access to ADSM Database via ODBC and Script? (Solved)

2001-02-05 12:02:20
Subject: Access to ADSM Database via ODBC and Script? (Solved)
From: Gerhard Rentschler <g.rentschler AT RUS.UNI-STUTTGART DOT DE>
Date: Mon, 5 Feb 2001 18:03:54 +0100
Hi,
with the help of Andy Raibeck (thanks!) I got my perl script to work with
ODBC. The problem was that Active State Perl distribution used an old
version of WIN32::ODBC module.

Here is how it works for me on Windows 2000 Professional. I use the ODBC
driver from TSM client 4.1.2.

1. Get and install Active State Perl build 623 from
http://www.activestate.com/Products/ActivePerl/. It is free of charge. But
check the license conditions.

2. Get the newer WIN32::ODBC from www.roth.net via PPM. Open the Windows
command line interface and type PPM. Type in the following command:
  install  http://www.roth.net/perl/packages/win32-odbcbeta.ppd
This will install the beta vwersion of Dave Roth's ODBC module. You need to
have windows admin rights.

3. Use the windows ODBC tool to define a DSN for TSM. Sorry, I can't explain
this in detail. My Win2k System is German and it is very difficult to
translate the menue names back to English :-(

4. Use the following script to read the DB table from TSM and print it. Set
DSN-name, adminid and password in the new Win32::ODBC.... statement to your
values.

#! /usr/bin/perl
# Test program to read TSM db via odbc
use WIN32::ODBC;
$db = new Win32::ODBC( "DSN=server1;UID=xxxx;PWD=yyyy" );
if (!($db)) {
 print "Error connecting to server1 \n";
 print "Error: " . Win32::ODBC::Error(). "\n";
 exit;
}
$SqlStatement = "Select * from DB";
if ($db->Run($SqlStatement)) {
        print "Error connecting to server1 \n";
        print "Error:" . Win32::Error() . "\n";
        $db->Close();
        exit;
}
 while ($db->FetchRow()) {
        undef %Data;
        %Data = $db->DataHash();
        foreach $column (sort keys %Data) {
                print $column, '=', $Data{$column}, "\n";
        }
}
$db->Close();
#end of script

To get more information you can consult Dave Roth's web pages at
www.roth.net. It contains pointers to other resources. One is
http://www.northbound-train.com/perlwin32.html#W32Modules. There is a
WIN32::ODBC tutorial.

As usual I cannot guarantee that the installation of perl and module as well
as the execution of the script will not do any harm to your system. Use it
on your own risk.

Also Andy Raibeck told me that using the ODBC interface with perl is not
supported by Tivoli.

Regardless of the preceding remarks: enjoy!

Best regards
Gerhard
---
Gerhard Rentschler            email:g.rentschler AT rus.uni-stuttgart DOT de
Gerhard Rentschler            email:g.rentschler AT rus.uni-stuttgart DOT de
Regional Computing Center     tel.   ++49/711/685 5806
University of Stuttgart       fax:   ++49/711/682357
Allmandring 30a
D 70550
Stuttgart
Germany
<Prev in Thread] Current Thread [Next in Thread>
  • Access to ADSM Database via ODBC and Script? (Solved), Gerhard Rentschler <=