AnsweredAssumed Answered

How to connect to drill via DBD::ODBC

Question asked by hirohata on Dec 25, 2017
Latest reply on Feb 7, 2018 by maprcommunity

Hello,

When accessing Drill via ODBC,it is connected with isql,but perl's DBD::ODBC can not be connect.
It seems that drivers and data sources are recognized in perl,but the can not connect.

------------------------------------------------
[root@poc ~]# odbcinst -q -s
[ODBC]
[MapR_Drill]

 

[root@poc ~]# isql -v "MapR_Drill"
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+

 

[root@poc ~]# perl odbcTest.pl
$VAR1 = [
'DBM',
'ExampleP',
'File',
'Gofer',
'ODBC',
'Proxy',
'Sponge'
];
$VAR1 = [
'dbi:ODBC:ODBC',
'dbi:ODBC:MapR_Drill'
];
set_err: state ('H') is not a 5 character string, using 'S1000' instead at /usr/lib64/perl5/vendor_perl/DBD/ODBC.pm line 157.
DBI connect('DSN=MapR_Drill','',...) failed: [unixODBC][ (SQL-H) at odbcTest.pl line 21
$VAR1 = \undef;


------------------------------------------------
[root@poc ~]# cat odbcTest.pl
#!/usr/bin/perl -w

use strict;
use warnings;

use Data::Dumper;

use Encode;
use utf8;
use DBI;


my @drivers = DBI->available_drivers;
print Dumper(\@drivers);


my @dsns = DBI->data_sources('ODBC');
print Dumper(\@dsns);


my $dbh = DBI->connect('dbi:ODBC:DSN=MapR_Drill');
print Dumper(\$dbh);
------------------------------------------------

 

The environment is as follows.

 

[mapr@hadoop ~]$ rpm -qa|grep drill
mapr-drill-1.10.0.201707281534-1.noarch

 

[root@poc ~]# cat /etc/system-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)

 

[root@poc ~]# perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

 

[root@poc ~]# rpm -qa|grep ODBC
unixODBC-2.2.14-14.el6.x86_64
unixODBC-devel-2.2.14-14.el6.x86_64

 

[root@poc ~]# odbcinst --version
unixODBC 2.2.14

 

[root@poc ~]# odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /etc/odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

 

[root@poc ~]# perl -MDBI -e 'DBI-> installed_versions;'
Perl : 5.010001 (x86_64-linux-thread-multi)
OS : linux (2.6.18-406.el5)
DBI : 1.609
DBD::Sponge : 12.010002
DBD::Proxy : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC
DBD::ODBC : 1.50
DBD::Gofer : 0.011565
DBD::File : 0.37
DBD::ExampleP : 12.010007
DBD::DBM : 0.03

 


Thanks in advance,
Yoshihiro

Outcomes