We help IT Professionals succeed at work.
Get Started

Perl fetch error from remote Dell KACE1000

JAaron Anderson
Last Modified: 2021-04-21
Oh mighty Perl Master Wizards !
I beseech your wisdom in my troubled past. For you see I have ventured on a noble quest but am lost on my journey. lol
(I feel this is an excerpt out of the movie "Your Highness" http://www.imdb.com/title/tt1240982/ lol)

anyhow ...

I am successfully BINDing to my remote Dell KACE1000 with this snippet :
      #!/usr/perl -w
      use DBI;
      my $database='MySQL ODBC 3.51 Driver';
      my $hostname=''
      my $username= 'R1'; #same for every customer
      my $password= 'box747'; #same for every customer
      my $dbh = DBI->connect("dbi:ODBC:DRIVER=$database;SERVER=$hostname;port=3306",$username$password)";

Open in new window


## herein lies error screen return on exec()my syntax confusion; Ive tried many statement approaches
## NONE of which seem to work valid
## this block gives me error confirming record/value traversal
## it is not returning anything; giving me this DBI::errstr error(s)
## bind_columns failed: called with 4 values but 74 are needed

      my $sql = "SELECT * FROM ORG1.MACHINE"; 
      ## SQL works in MySQL studio where ORG1:db and MACHINE:table
      my $sth = $dbh->prepare($sql);
      ## should I be sure to inject (undef)
      my ($ID, $NAME, $USER, $MAC); 
      ## Titles correspond to Schema Viewer table names in CAPS
      #BIND results to variables ?
      $sth->bind_columns(undef, \$ID, \$NAME, \$USER, \$MAC);
      ##retrieve / return results
      while( $sth->fetch() ) {
            print "$ID, $NAME, $USER, $MAC\n";

Open in new window

## any help is very much appreciated
Watch Question
This problem has been solved!
Unlock 4 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE