Archive for the DWH category

9月 12th, 2013

GreenplumDB + RODBC

Posted in DWH by admin

RからGreenplum DBぜ ODBC接続するRODBCの環? 設?

configure: error: "ODBC headers sql.h and sqlext.h not found"
configure: error: "no ODBC driver manager found"
checking size of long... configure: error: cannot compute sizeof (long), 77

R CMD INSTALLで? のようぜ configure errorが出ていたが、
以? のコマンドで接続まで確認できた。

# export LDFLAGS='-Xlinker -rpath /usr/local/greenplum-connectivity-4.2.5.0-build-1\
/drivers/odbc/psqlodbc-08.02.0500/unixodbc-2.2.12'
# export LD_LIBRARY_PATH=/usr/local/greenplum-connectivity-4.2.5.0-build-1/drivers\
/odbc/psqlodbc-08.02.0500/unixodbc-2.2.12
# R CMD INSTALL RODBC_1.3-5.tar.gz --configure-args='--with-odbc-manager=odbc \
--with-odbc-include=/usr/local/greenplum-connectivity-4.2.5.0-build-1/drivers/odbc\
/psqlodbc-08.02.0500/unixodbc-2.2.12/include --with-odbc-lib=/usr/local/greenplum-\
connectivity-4.2.5.0-build-1/drivers/odbc/psqlodbc-08.02.0500/unixodbc-2.2.12'
# vi /usr/local/greenplum-connectivity-4.2.5.0-build-1/greenplum_connectivity_path.sh
GP_ODBC_DRIVER=psqlodbc-08.02.0500
GP_ODBC_DRIVER_MANAGER=datadirect-52_64
~
# su - gpadmin
$ vi .odbc.ini
[greenplum]
Description = PostgreSQL driver for Greenplum
Driver = /usr/local/greenplum-connectivity-4.2.5.0-build-1/drivers/odbc\
/psqlodbc-08.02.0500/unixodbc-2.2.12/psqlodbcw.so
Trace = 1
Debug=1
Database = testdb
Servername = ms01
UserName = gpadmin
Password = password
Port = 5432
ReadOnly = No
RowVersioning = No
DisallowPremature = No
ShowSystemTables = Yes
ShowOidColumn = No
FakeOidIndex = No
useDeclareFetch = 1
Fetch = 4096
UpdatableCursors = No
Protocol = 7.4-1
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/greenplum-connectivity-\
4.2.5.0-build-1/drivers/odbc/psqlodbc-08.02.0500/unixodbc-2.2.12"
$ R
> library(RODBC)
> ch < - odbcConnect("greenplum", uid="gpadmin", case="postgresql", pwd="password")
> sqlColumns(ch, "testtable")
> sqlQuery(ch, "SELECT * FROM testtable")
> odbcClose(ch)