ADSM-L

Re: Access to ADSM Database via ODBC and Script? (aside)

2001-02-01 16:32:51
Subject: Re: Access to ADSM Database via ODBC and Script? (aside)
From: arhoads <arhoads AT PACBELL DOT NET>
Date: Thu, 1 Feb 2001 13:25:27 -0800
Dan,

go ahead & post it.

Thanks,

Steffan

Dan Giles wrote:
>
> F.Y.I.
> There is a perl module for adsm - Adsm.pm by Owen Crow . I just looked 
> through CPAN
> but couldn't find it. It's pretty old, and I had to make a slight 
> modification for
> v3. Also, I haven't tested it yet for TSM v4. It allows you to make *SM calls
> directly from your perl script.
>
> So, if anyone's interested, let me know and I'll post a copy here.
>
> Regards
>
> Xavier Merlin wrote:
>
> > Very interesting and quite a coincidence !
> >
> > Yesterday I was reading perl and when I read something about ODBC I said to
> > myself: this is the thing to use  if it works with adsm.
> >
> > Right now I am using a construct like system(" dmsadmc -id=secret  
> > -pa=secret <
> > some_sqlscript") from within a perl script , the some_sqlscript does 
> > contains
> > select ... from ... where ... clauses.
> >
> > It would indeed be nicer to query directly the tables from within perl using
> > ODBC for that.
> >
> > I am quite novice on ODBC and these things intrigue me, so let me know if 
> > there
> > is anything to learn from you adsm guru guys on this subject
> >
> > Xavier
> >
> >         g.rentschler AT RUS.UNI-STUTTGART DOT DE
> >         31/01/01 17:01
> >
> >                  To: ADSM-L AT VM.MARIST DOT EDU@Internet
> >                  cc: (bcc: Xavier Merlin/U18218/KB/KredAlm)
> >                  Subject: Access to ADSM Database via ODBC and Script?
> >
> > Hi,
> > I've just spent more than one day in vain trying to develop a script which
> > should get data from the ADSM DB via ODBC. First I used Active State Perl
> > (see http://www.activestate.com/Products/ActivePerl/ for more info) and
> > module Win32::ODBC. This crashes the whole perl interpreter. Using Jscript
> > with Windows Scripting Host and ADO leads to a serious runtime error.
> > However, according the activity log the connection to the server succeeds. I
> > will append both programs to the bottom of the mail.  The Jscript example is
> > incomplete. I get a log but this does not give any hint on the problem. I
> > was successful to use Excel 2000 to get the data from ADSM DB.
> >
> > Has anyone managed to use a script to gather data from the *SM DB using
> > ODBC? Is there any information available on how to use the *SM ODBC driver
> > or on the error codes?
> >
> > As stated in other mails access to ADSM management data is important. A
> > general administration API certainly would be much better. In the meantime a
> > ODBC driver which can be used from scripts would help me a lot. Getting the
> > data via calls to dsmadmc and redirection of command output is at least not
> > very elegant.
> >
> > Best regards
> > Gerhard
> > ---
> > 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
> >
> > Here is the Perl script:
> >
> > #! /usr/bin/perl
> > use WIN32::ODBC;
> > $db = new Win32::ODBC( "DSN=server;UID=bigadmin;PWD=secret" );
> > if (!($db)) {
> >  print "Error connecting zu rusadsm1 \n";
> >  print "Error: " . Win32::ODBC::Error(). "\n";
> >  exit;
> > }
> > $SqlStatement = "Select * from Nodes";
> > # the next statement causes the runtime error
> > if ($db->Sql($SqlStatement)) {
> >         print "Error connecting to rusadsm1 \n";
> >         print "Error:" . Win32::Error() . "\n";
> >         $db->Close();
> >         exit;
> > }
> >  while ($db->FetchRow()) {
> >         undef %Data;
> >         %Data = $db->DataHash();
> >         foreach $spalte (sort keys %Data) {
> >                 print $spalte, '=', $Data{$spalte}, "\n";
> >         }
> > }
> > $db->Close();
> >
> > And here comes the Jscript:
> >
> > //example incomplete
> > var conn;
> > conn = new ActiveXObject("ADODB.Connection");
> > //the next statment causes the runtime error
> > conn.Open("server","bigadmin","secret");
> > var dbRecord = WScript.CreateObject("ADODB.Recordset");
> > var sql = "SELECT * FROM DB";
> > dbRecord.Open (sql, conn, adOpenKeyset, adLockOptimistic);
> > conn.Close();
>
> --
> Dan Giles, Tivoli Certified Consultant - TSM 3.7
> phone: (416) 402-9744
> e-mail: dangiles AT sympatico DOT ca
<Prev in Thread] Current Thread [Next in Thread>