Search code examples
perlobiee

How to login OBIEE Server credentials from perl script


I need to create a procees which generates a txt file from the reports. I need to login into OBiee Bussiness Intelignce, give the credentails and generate a report with respective column names and load the data in to text file. I don't know OBIEE or Perl. I Googled and found some related URL

http://gerardnico.com/wiki/dat/obiee/catalog_manager

I need to login in to Obiee Tool with following credential using Perl script. How can I login into server using Perl?

What I have tried so far is:

use strict;

use warnings;
  

Error:

Missing or bad "-output file"


Solution

  • I have no idea what this is or what it does, but from the doc at the URL you found, it appears like the API allows a query like so:

    catalogmanager -online http://localhost:9704/analytics/saw.dll
    -login Administrator -pwd Administrator
    -cmd report -of c:\output.csv -delimiter \",\"
    -type Requests \"Request Name\" \"Request Criteria Column\"
    

    If I read this correctly, then you should provide in this call:

    • The correct server, i.e., replace `localhost` with your hostname if the catalogmanager or whatever is not running on the local machine
    • The username and password as arguments to `-login` and `-pwd`
    • An output file name as argument to `-of` (it will probably be a CSV file)
    • And some sort of request structure that should be provided in place of "Request Name" and "Request Criteria Column"

    And you would use this in Perl in a script like this:

    use strict;
    use warnings;
    
    # change this to your URL
    my $address        = 'http://localhost:9704/analytics/saw.dll';
    my $username       = 'ADMIN';  # change this to your username
    my $pwd            = 'PASSWORD';  # change this to your password
    my $outputfile     = 'PATH_TO_OUTPUT_FILE';  # change this to your output file
    my $delimiter      = ',';
    my $request_name   = 'REQUEST_NAME';  # adjust this
    my $request_column = 'REQUEST_COLUMN';  # and this
    
    my @call = qq( catalogmanager -online $address -login $username 
        -pwd $password -cmd report -of $outputfile -delimiter $delimiter 
        -type Requests $request_name $request_column );
    
    # system() returns true if the call was not successful,
    # we can make use of this and let the program die if something went wrong
    system(@call) and die("Could not exec @call: $!\n");
    

    And it should hopefully write an output file to the path you specified. This file you can parse, but that is a different matter.