Queries from Ruby via ODBC

Posted by etjgalvez on 07-Apr-2014 19:04

I am trying to query a Progress OpenEdge Database from a ruby application.

I am unable to get ruby-odbc to compile against the Progress ODBC driver include files.

Perls DBD::ODBC compiled just fine and I can query from perl.

Any suggestions?

I've tried both DataDirect Connect64 drivers and the Progress OpenEdge SQL Client Access drivers.

I get the same error with both libraries.

47501odbc:~ # gem install ruby-odbc -- --with-odbc-dir=/usr/dlc/odbc
Building native extensions with: '--with-odbc-dir=/usr/dlc/odbc'
This could take a while...
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/dlc in PATH, mode 040777
ERROR:  Error installing ruby-odbc:
        ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb --with-odbc-dir=/usr/dlc/odbc
checking for version.h... no
checking for sql.h... yes
checking for sqlext.h... yes
checking for SQLTCHAR in sqltypes.h... no
checking for SQLLEN in sqltypes.h... no
checking for SQLULEN in sqltypes.h... no
checking for odbcinst.h... yes
checking for SQLAllocConnect() in -lodbc... yes
checking for SQLConfigDataSource() in -lodbcinst... no
checking for SQLConfigDataSource() in -liodbcinst... no
checking for SQLInstallerError() in odbcinst.h... yes
checking for SQLBIGINT in sqltypes.h with -DHAVE_LONG_LONG... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling init.c
compiling odbc.c
odbc.c:47: error: redefinition of typedef ‘SQLTCHAR’
/usr/dlc/odbc/include/sqltypes.h:329: error: previous declaration of ‘SQLTCHAR’ was here
odbc.c:2404: error: ‘SQL_DTC_TRANSITION_COST’ undeclared here (not in a function)
odbc.c:2709: error: ‘SQL_DTC_ENLIST_EXPENSIVE’ undeclared here (not in a function)
odbc.c:2709: error: initializer element is not constant
odbc.c:2709: error: (near initialization for ‘get_info_bitmap[201].bits’)
odbc.c:2710: error: ‘SQL_DTC_UNENLIST_EXPENSIVE’ undeclared here (not in a function)
odbc.c:2710: error: initializer element is not constant
odbc.c:2710: error: (near initialization for ‘get_info_bitmap[202].bits’)
odbc.c:7993: error: ‘SQL_CP_OFF’ undeclared here (not in a function)
odbc.c:7993: error: initializer element is not constant
odbc.c:7993: error: (near initialization for ‘o_const[44].value’)
odbc.c:7994: error: ‘SQL_CP_ONE_PER_DRIVER’ undeclared here (not in a function)
odbc.c:7994: error: initializer element is not constant
odbc.c:7994: error: (near initialization for ‘o_const[45].value’)
odbc.c:7995: error: ‘SQL_CP_ONE_PER_HENV’ undeclared here (not in a function)
odbc.c:7995: error: initializer element is not constant
odbc.c:7995: error: (near initialization for ‘o_const[46].value’)
odbc.c:7996: error: ‘SQL_CP_DEFAULT’ undeclared here (not in a function)
odbc.c:7996: error: initializer element is not constant
odbc.c:7996: error: (near initialization for ‘o_const[47].value’)
make: *** [odbc.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.1/gems/ruby-odbc-0.99995 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/ruby-odbc-0.99995/gem_make.out


All Replies

Posted by Marian Edu on 08-Apr-2014 00:23

you might want to check out Abe's taken on this one... guess he was
using the JDBC approach instead, and yes please skip the dinosaurs intro
to avoid starting a fire again :)

https://blog.abevoelker.com/final-ode-to-openedge-abl-part-1-a-ruby-adapter-is-born/

[collapse]On 04/08/2014 03:05 AM, etjgalvez wrote:
>[collapse] From: etjgalvez
> Post: Queries from Ruby via ODBC
> Posted in: OpenEdge Development
> Link: http://community.progress.com/technicalusers/f/19/t/9394.aspx
>
> I am trying to query a Progress OpenEdge Database from a ruby application.
> I am unable to get ruby-odbc to compile against the Progress ODBC driver include files.
> PerlsDBD::ODBC compiled just fine and I can query from perl.
> Any suggestions?
> I've tried both DataDirect Connect64 drivers and the Progress OpenEdge SQL Client Access drivers.
> I get the same error with both libraries.
> 47501odbc:~ # gem install ruby-odbc -- --with-odbc-dir=/usr/dlc/odbc
> Building native extensions with: '--with-odbc-dir=/usr/dlc/odbc'
> This could take a while...
> /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/dlc in PATH, mode 040777
> ERROR:Error installing ruby-odbc:
> ERROR: Failed to build gem native extension.
>
> /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb --with-odbc-dir=/usr/dlc/odbc
> checking for version.h... no
> checking for sql.h... yes
> checking for sqlext.h... yes
> checking for SQLTCHAR in sqltypes.h... no
> checking for SQLLEN in sqltypes.h... no
> checking for SQLULEN in sqltypes.h... no
> checking for odbcinst.h... yes
> checking for SQLAllocConnect() in -lodbc... yes
> checking for SQLConfigDataSource() in -lodbcinst... no
> checking for SQLConfigDataSource() in -liodbcinst... no
> checking for SQLInstallerError() in odbcinst.h... yes
> checking for SQLBIGINT in sqltypes.h with -DHAVE_LONG_LONG... no
> creating Makefile
>
> make "DESTDIR=" clean
>
> make "DESTDIR="
> compiling init.c
> compiling odbc.c
> odbc.c:47: error: redefinition of typedef ‘SQLTCHAR’
> /usr/dlc/odbc/include/sqltypes.h:329: error: previous declaration of ‘SQLTCHAR’ was here
> odbc.c:2404: error: ‘SQL_DTC_TRANSITION_COST’ undeclared here (not in a function)
> odbc.c:2709: error: ‘SQL_DTC_ENLIST_EXPENSIVE’ undeclared here (not in a function)
> odbc.c:2709: error: initializer element is not constant
> odbc.c:2709: error: (near initialization for ‘get_info_bitmap[201].bits’)
> odbc.c:2710: error: ‘SQL_DTC_UNENLIST_EXPENSIVE’ undeclared here (not in a function)
> odbc.c:2710: error: initializer element is not constant
> odbc.c:2710: error: (near initialization for ‘get_info_bitmap[202].bits’)
> odbc.c:7993: error: ‘SQL_CP_OFF’ undeclared here (not in a function)
> odbc.c:7993: error: initializer element is not constant
> odbc.c:7993: error: (near initialization for ‘o_const[44].value’)
> odbc.c:7994: error: ‘SQL_CP_ONE_PER_DRIVER’ undeclared here (not in a function)
> odbc.c:7994: error: initializer element is not constant
> odbc.c:7994: error: (near initialization for ‘o_const[45].value’)
> odbc.c:7995: error: ‘SQL_CP_ONE_PER_HENV’ undeclared here (not in a function)
> odbc.c:7995: error: initializer element is not constant
> odbc.c:7995: error: (near initialization for ‘o_const[46].value’)
> odbc.c:7996: error: ‘SQL_CP_DEFAULT’ undeclared here (not in a function)
> odbc.c:7996: error: initializer element is not constant
> odbc.c:7996: error: (near initialization for ‘o_const[47].value’)
> make: *** [odbc.o] Error 1
>
> make failed, exit code 2
>
> Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.1/gems/ruby-odbc-0.99995 for inspection.
> Results logged to /usr/local/rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/ruby-odbc-0.99995/gem_make.out
>
>
> --
> You were sent this email because you opted to receive email notifications when someone created a new thread.
>
> To unsubscribe[collapse] from:
> - ...only this thread, disable notifications at http://community.progress.com/technicalusers/f/19/t/9394.aspx.
> - ...all email notifications from Progress Community, navigate to "Settings", click on the "Email" tab, then under the "Email Configuration" section, set Send Notifications to "No".
>
>


--
m.edu
keep it simple
http://www.ganimede.ro
http://ro.linkedin.com/in/marianedu
medu@ganimede.ro
mobile: +40 740 036 212
skype: marian.edu[/collapse][/collapse][/collapse]

Posted by Bill Wood on 08-Apr-2014 04:42

A suggestion... Given that the OpenEdge and DataDirect Drivers are really the same underneath, and that all DataDirect Connect drivers share common components, it might be useful to cross-post this question I the DataDirect Connect forum.

They may have general comments on Ruby/DataDirect Connectivity. =

Posted by etjgalvez on 08-Apr-2014 09:52

Thanks.  I had seen that.  I'd really prefer to use the compiled ODBC driver instead of having to load the JDBC driver into jruby.

Posted by etjgalvez on 08-Apr-2014 09:52

I'll cross post over thare.  Thanks!

This thread is closed