Re:Help to connect Lua with IBM-DB2 Through LuaSQL

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re:Help to connect Lua with IBM-DB2 Through LuaSQL

T Poojita/CHN/TCS
On 01/08/14 06:53, T Poojita wrote:
> Dear Users,
>
> We have been trying to connect with IBM-DB2 through LuaSQL ODBC on Linux
> machine.
>
> I have edited the config file to make odbc, libodbc* libraries are
> present in the path :
> /usr/lib64/
> While making luasql for odbc, the below error appears:
> src/ls_odbc.c:23:17: error: sql.h: No such file or directory
> src/ls_odbc.c:24:22: error: sqltypes.h: No such file or directory
> src/ls_odbc.c:25:20: error: sqlext.h: No such file or directory
>
> Also below rpm packages are found installed in my system, should I
> install any special rpm for reaching IBM-DB2 through ODBC ?
>
> unixODBC-2.2.14-12.el6_3.x86_64


I don't use RPM based systems, or ODBC on Linux, but...

You'll probably need the unixODBC-devel[0] package, which contains the
files to compile against like 'sql.h'

But you'll also need to find a DB2 driver for ODBC to use. UnixODBC will
be able to point you to them (and give support for setting up that side
of things):

http://www.unixodbc.org/

Maybe this:
http://www-03.ibm.com/systems/power/software/i/access/linux.html

Scott

[0]
http://rpmfind.net//linux/RPM/centos/6.5/x86_64/Packages/unixODBC-devel-2.2.14-12.el6_3.x86_64.html


-------

Hi Scott,

Thank you for your reply.

I have a small doubt regarding the connectivity to db2.

When I try to "make" the luasql.odbc file, the make file compiles with the following warnings

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -ansi -pedantic -fPIC -DUNIXODBC -I/usr/local/include -I/usr/local/include -DLUASQL_VERSION_NUMBER='"2.3.0"'    -c -o src/luasql.o src/luasql.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -ansi -pedantic -fPIC -DUNIXODBC -I/usr/local/include -I/usr/local/include -DLUASQL_VERSION_NUMBER='"2.3.0"'    -c -o src/ls_odbc.o src/ls_odbc.c
src/ls_odbc.c: In function âfailâ:
src/ls_odbc.c:132: warning: pointer targets in passing argument 6 of âSQLGetDiagRecâ differ in signedness
/usr/include/sql.h:711: note: expected âSQLCHAR *â but argument is of type âchar *â
src/ls_odbc.c: In function âcreate_colinfoâ:
src/ls_odbc.c:382: warning: pointer targets in passing argument 2 of âlua_pushstringâ differ in signedness
/usr/local/include/lua.h:210: note: expected âconst char *â but argument is of type âSQLCHAR *â
src/ls_odbc.c: In function âconn_executeâ:
src/ls_odbc.c:467: warning: pointer targets in passing argument 2 of âSQLPrepareâ differ in signedness
/usr/include/sql.h:746: note: expected âSQLCHAR *â but argument is of type âchar *â
src/ls_odbc.c:496: warning: passing argument 2 of âSQLRowCountâ from incompatible pointer type
/usr/include/sql.h:752: note: expected âSQLLEN *â but argument is of type âSQLINTEGER *â
src/ls_odbc.c: In function âenv_connectâ:
src/ls_odbc.c:601: warning: pointer targets in passing argument 2 of âSQLConnectâ differ in signedness
/usr/include/sql.h:617: note: expected âSQLCHAR *â but argument is of type âchar *â
src/ls_odbc.c:601: warning: pointer targets in passing argument 4 of âSQLConnectâ differ in signedness
/usr/include/sql.h:617: note: expected âSQLCHAR *â but argument is of type âchar *â
src/ls_odbc.c:601: warning: pointer targets in passing argument 6 of âSQLConnectâ differ in signedness
/usr/include/sql.h:617: note: expected âSQLCHAR *â but argument is of type âchar *â
export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -ansi -pedantic -fPIC -DUNIXODBC -I/usr/local/include -I/usr/local/include -DLUASQL_VERSION_NUMBER='"2.3.0"'  -o src/odbc.so -shared  src/luasql.o src/ls_odbc.o -L/usr/lib64 -lodbc


Since we got the warnings, we removed the make file by using "make clean" command and again performed "make" operation, but the same warnings were generated and as a result we are unable to connect with db2.

We would like to know the reason behind these warnings and the way to solve it.

Kindly share your thoughts.

Thank you for your valuable time.
 



 Regards,
Poojita

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

Reply | Threaded
Open this post in threaded view
|

Re: Help to connect Lua with IBM-DB2 Through LuaSQL

Scott Morgan
On 06/08/14 10:54, T Poojita wrote:

> Thank you for your reply.
>
> I have a small doubt regarding the connectivity to db2.
>
> When I try to "make" the luasql.odbc file, the make file compiles with
> the following warnings
>
> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -ansi
> -pedantic -fPIC -DUNIXODBC -I/usr/local/include -I/usr/local/include
> -DLUASQL_VERSION_NUMBER='"2.3.0"'    -c -o src/luasql.o src/luasql.c
> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -ansi
> -pedantic -fPIC -DUNIXODBC -I/usr/local/include -I/usr/local/include
> -DLUASQL_VERSION_NUMBER='"2.3.0"'    -c -o src/ls_odbc.o src/ls_odbc.c
> src/ls_odbc.c: In function âfailâ:
> src/ls_odbc.c:132: warning: pointer targets in passing argument 6 of
> âSQLGetDiagRecâ differ in signedness
> /usr/include/sql.h:711: note: expected âSQLCHAR *â but argument is of
> type âchar *â
> src/ls_odbc.c: In function âcreate_colinfoâ:
> src/ls_odbc.c:382: warning: pointer targets in passing argument 2 of
> âlua_pushstringâ differ in signedness
...snip...
>
> Since we got the warnings, we removed the make file by using "make
> clean" command and again performed "make" operation, but the same
> warnings were generated and as a result we are unable to connect with db2.
>
> We would like to know the reason behind these warnings and the way to
> solve it.
>
> Kindly share your thoughts.

Most the warnings aren't fatal, just an irritating artefact of 'SQLCHAR'
being defined as 'unsigned char' as opposed to plain 'char' (no idea why
the ODBC spec does that, all it does is cause these problems, the data
is unaffected)

The worst one is:
> src/ls_odbc.c:496: warning: passing argument 2 of âSQLRowCountâ from incompatible pointer type
> /usr/include/sql.h:752: note: expected âSQLLEN *â but argument is of type âSQLINTEGER *â
> src/ls_odbc.c: In function âenv_connectâ:

Which should be changed.

I've opened a couple of tickets:
https://github.com/keplerproject/luasql/issues/18
https://github.com/keplerproject/luasql/issues/19

Scott