cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
152
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Michael Schmidt on 06-05-2013 07:30:04 AM
Hi,

I want to use such Perl-Script to run a sql query against CAR Database like I can do this sql directly from CLI at CUCM:
 
run sql car select * FROM tbl_billing_data where datetimestamporigination between '2013-05-06 00:00:00' and '2013-05-07 00:00:00' ORDER BY datetimestamporigination
 
But when I try to use the "car select" command in the Perl-Script I get back the error "A syntax error has occurred".
 
Is it possible to use "car select" in a Perl Script or is there any other way to schedule such a SQL like "run sql car select * FROM tbl_billing_data where datetimestamporigination between '2013-05-06 00:00:00' and '2013-05-07 00:00:00' ORDER BY datetimestamporigination"?
 
 1
 2#!/usr/bin/perl
 3
 4use warnings;
 5use strict;
 6use SOAP::Lite;
 7use Data:umper;
 8
 9my $DEBUG = 1;
10my $cucmip = '127.0.0.1';
11my $axl_port = '8443';
12my $user = 'AXLUSER';
13my $password = 'AXLPASS';
14my $error_text;
15
16BEGIN {
17  sub SOAP::Transport::HTTP::Client::get_basic_credentials {
18    return ($user => $password)
19  };
20}
21
22use SOAP::Lite +trace => 'debug';
23
24my $cm = new SOAP::Lite
25    encodingStyle => '',
26    uri => 'http://www.cisco.com/AXL/API/1.0',
27    proxy => "https://$cucmip:$axl_port/axl/" ;
28
29my $axl_sql = "SELECT * FROM device";
30
31print "\$axl_sql: $axl_sql\n" if ( $DEBUG==1);
32my $data = SOAP:ata->name( "sql" => $axl_sql );
33my $res = $cm->executeSQLQuery( $data );
34unless ($res->fault) {
35  $Data:umper::Indent = 3;
36  print Dumper($res->paramsall()) if ( $DEBUG==1);
37} else {
38  $error_text = $res->faultcode.' '.$res->faultstring."\n";
39  print $error_text;
40}
 
BR
Michael
 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links