Menu

OCESQL example

2020-07-04
2024-06-04
<< < 1 2 (Page 2 of 2)
  • thomas

    thomas - 2020-07-26

    Hi,
    What happens when you compile like this?

    LANG=EN cobc -x -static --verbose -locesql -lm inserttbl.cob -L/usr/local/lib  -llibocesql.so.0
    
     
    • celsofigueiredo

      celsofigueiredo - 2020-07-26

      Dear thom.

      The result is this:

      celso@celso-Inspiron-3583:~/Cobol/sample$ LANG=EN cobc -x -static --verbose -locesql -lm inserttbl.cob -L/usr/local/lib  -llibocesql.so.0
      cobc (GnuCOBOL) 3.1-rc1.0
      Built     Jul 25 2020 09:21:01  Packaged  Jul 01 2020 00:39:30 UTC
      C version "5.4.0 20160609"
      loading standard configuration file 'default.conf'
      command line:   cobc -x -static --verbose -locesql -lm -L/usr/local/lib -llibocesql.so.0 inserttbl.cob 
      preprocessing:  inserttbl.cob -> /tmp/cob5856_0.cob
      return status:  0
      parsing:    /tmp/cob5856_0.cob (inserttbl.cob)
      return status:  0
      translating:    /tmp/cob5856_0.cob -> /tmp/cob5856_0.c (inserttbl.cob)
      executing:  gcc -c -I/usr/local/include -Wno-unused -fsigned-char
              -Wno-pointer-sign -pipe -o "/tmp/cob5856_0.o"
              "/tmp/cob5856_0.c"
      return status:  0
      executing:  gcc -Wl,--export-dynamic -o "inserttbl" "/tmp/cob5856_0.o"
              -L"/usr/local/lib" -L/usr/local/lib -lcob -lm -l"ocesql" -l"m"
              -l"libocesql.so.0"
      /usr/bin/ld: cannot find -llibocesql.so.0
      collect2: error: ld returned 1 exit status
      return status:  1
      

      Where am I going wrong?

      Celso Henrique.

       
  • Simon Sobisch

    Simon Sobisch - 2020-07-26

    It does not find the library at run time.
    Add

    /usr/local/lib
    

    to LD_LIBRARY_PATH and it should work fine.

     
    • celsofigueiredo

      celsofigueiredo - 2020-07-26

      Dear Simon Sobisch

      I compiled the program as follows now:

      celso@celso-Inspiron-3583:~/Cobol/sample$ export LD_LIBRARY_PATH=/usr/local/lib
      celso@celso-Inspiron-3583:~/Cobol/sample$ LANG=EN cobc -x -static --verbose -locesql -lm inserttbl.cob
      cobc (GnuCOBOL) 3.1-rc1.0
      Built     Jul 25 2020 09:21:01  Packaged  Jul 01 2020 00:39:30 UTC
      C version "5.4.0 20160609"
      loading standard configuration file 'default.conf'
      command line:   cobc -x -static --verbose -locesql -lm inserttbl.cob 
      preprocessing:  inserttbl.cob -> /tmp/cob6423_0.cob
      return status:  0
      parsing:    /tmp/cob6423_0.cob (inserttbl.cob)
      return status:  0
      translating:    /tmp/cob6423_0.cob -> /tmp/cob6423_0.c (inserttbl.cob)
      executing:  gcc -c -I/usr/local/include -Wno-unused -fsigned-char
              -Wno-pointer-sign -pipe -o "/tmp/cob6423_0.o"
              "/tmp/cob6423_0.c"
      return status:  0
      executing:  gcc -Wl,--export-dynamic -o "inserttbl" "/tmp/cob6423_0.o"
              -L/usr/local/lib -lcob -lm -l"ocesql" -l"m"
      return status:  0
      celso@celso-Inspiron-3583:~/Cobol/sample$ ./inserttbl
      *** INSERTTBL STARTED ***
      *** SQL ERROR ***
      SQLSTATE: 08001
      Connection falied
      celso@celso-Inspiron-3583:~/Cobol/sample$ 
      

      Thus, the program compiled without errors, but at the time of execution, it gave an error.
      Where is the donkey here, doing wrong?
      Celso Henrique.

       
<< < 1 2 (Page 2 of 2)

Anonymous
Anonymous

Add attachments
Cancel