#!/usr/bin/perl
use strict;
use DBI;
use warnings;
my $user = "database_user";
my $pass = "database_password";
my $server = "ip";
my $database_name = "db";
my $connectString = "driver={GBase ODBC 8.3 Driver};server=$server;database=$database_name;uid=$user;pwd=$pass";
my $dbh = DBI->connect("DBI:ODBC:$connectString")|| die "Connect failed: $DBI::errstr\n";
When I tried to execute the a.pl script to connect the database, I got the following errors:
install_driver(ODBC) failed: Can't locate DBD/ODBC.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3.
Perhaps the DBD::ODBC perl module hasn't been fully installed,
or perhaps the capitalisation of 'ODBC' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
Then I tried to run perl -e 'use DBD::ODBC;'
and got same error:
Can't locate DBD/ODBC.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Can somebody help me to fix it?