Menu

ODBTP on 64 bit OS problem with char

Help
paquins
2010-02-26
2013-04-22
  • paquins

    paquins - 2010-02-26

    Hi, Robert
    I am trying to make work the ODBTP on a 64 bit OS, namely OpenVMS on Itanium. The environment is OpenVMS 8.3 on Itanium server. I use HP C v7.3 to compile with default settings.

    I have some strange behavior when  accessing character strings. It looks like the string pointer is not aligned on the beginning of the string exactly.
    I have enabled 64 bit by uncommenting _C_LONG_64_ in odbtp.h. The code works correctly with binary data, integer and float values.

    I have a test database SQL Server 2k5 on windows XP with some sample columns like this
    CREATE TABLE .(
      IDENTITY(1,1) NOT NULL,
      NOT NULL,
      NOT NULL,
      NOT NULL,
      NOT NULL,
      NOT NULL,
      NOT NULL,
    (50) NOT NULL,
    (50) NOT NULL,
      NOT NULL )

    I put 3 rows of data in the table. When the select is like follows, it works correctly, that is I can get all the columns values.
    select Id, ISmallInt, InInt, FFloat, FReal, IBigInt, IBit
    from odbTest
    This works perfectly.

    When I change the select and try to get at CChar column, I have trouble with the string pointer and need to move 4 bytes to get at the correct beginning of string but I do get the data.
    select Id, ISmallInt, InInt, FFloat, FReal, IBigInt, IBit,CChar from odbTest

    If I add the second char column, it does not work anymore. I suppose you have tested ODBTP client code on a 64 bit OS. Do you have any idea what is happening? Any particular setting I must check?
    Thanks
    Steve

     
  • Robert Twitty

    Robert Twitty - 2010-02-27

    I am successfully using ODBTP on a 64-bit OS, and so too are many others.   This is the first report of this nature.  However, I believe everyone is using GCC to compile ODBTP.  Thus, it might pertain to the compiler you are using.  Are you using PHP or C for ODBTP client testing?  Did you try using odbtpcli (ODBTP C client utility) for query execution?

    • bob
     
  • paquins

    paquins - 2010-02-27

    Hi
    Since it is working correctly on other 64 bit platforms, it is probably a problem related to the compiler options. I am using the ODBTP client interface. I will try odbtpcli on Monday.
    Note that it works as expected with binary data. Only character columns give me problems.
    TIA
    Steve

     
  • paquins

    paquins - 2010-03-04

    Robert
    I confirm the problem is related to my compiler and code because the odbtpcli utility works perfectly as expected.
    Good work
    Steve

     
  • paquins

    paquins - 2010-03-12

    Hi
    I pinpointed the problem. It is caused by the compiler difference of interpretation of the long datatype on Tru64 and on OpenVMS. On Tru64, long is 64 bit. On VMS, long is 32 bits. I had to remove the 64bit  flag eventhough I am running this on OpenVMS Itanium 64 bit platform. After that, everything worked as expected.
    Steve

     

Log in to post a comment.