Menu

Error postgresql connectiona in ubuntu 22.04

Anonymous
2023-02-07
2023-03-02
  • Anonymous

    Anonymous - 2023-02-07

    Dear.
    I'm using Ubuntu 22.04 and decided to test Postgres, I found an example here on the list. I installed Postgres on linux without errors and then completed the database example, also without errors:

    #!/bin/bash
    
    # SQLCA: SQL Communications Area for Ocesql
    COPY=/home/$USER/Open-COBOL-ESQL-master/copy
    SCR=/usr/local/share/gnucobol/copy
    OC_OBJ=/home/$USER/Open-COBOL-ESQL-master/dblib
    
    # clean
    rm PGTEST7
    rm PGMOD7.cob
    
    # SQL precompile
    ocesql PGMOD7.cbl PGMOD7.cob
    
    # static compile
    cobc -x PGTEST7.cob PGMOD7.cob PGSQLMSG.cob $OC_OBJ/ocdb.o $OC_OBJ/ocdblog.o $OC_OBJ/ocdbutil.o $OC_OBJ/ocesql.o $OC_OBJ/ocpgsql.o -I$COPY -I$SCR -locesql -lpq
    

    And then:

    #!/bin/bash
    
    # log file
    # export OCDB_LOGFILE=/tmp/ocesql.log
    
    # If OCDB_LOGLEVEL is set, then the ocesql.log file is created under /tmp
    # Possible values:
    # - nothing to set -> same as NOLOG
    # - NOLOG or nolog
    # - ERR or err
    # - DEBUG or debug
    export OCDB_LOGLEVEL=DEBUG
    
    # If you do not set the OCDB_DB_CHAR environment variable, then "SJIS" will be
    # used as default. See ocesql.c in _ocesqlConnectMain() function.
    # If it is not set, then there are errors for example at duplicate key.
    export OCDB_DB_CHAR=UTF8
    
    # start program
    ./PGTEST7
    

    Mod-Edit: formatting

     

    Last edit: Simon Sobisch 2023-02-07
  • Simon Sobisch

    Simon Sobisch - 2023-02-07

    So the first question is: does it work using a psql command?

    Note: you currently use ocesql, so you possibly want to check out the "more modern" GixSQL (which also supports ocesql's syntax in all places I've tested).

    Additional note: Please always prefer text output over image output, the later won't be seen when searching. Also consider to register/login before posting, removing the moderation need (and if you don't then please post only once, then waiting at least 48 hours before posting the same).

     
  • Anonymous

    Anonymous - 2023-02-28

    Dear, I tried to use gixSQL, both in linux and in windows, but without success. Even the examples didn't work.
    What is the correct way to use psql?

     
    • Simon Sobisch

      Simon Sobisch - 2023-03-02

      Dear, I tried to use gixSQL, both in linux and in windows, but without success. Even the examples didn't work.

      I can't reproduce this, worked fine (of course you need a DB server running and setup accordingly).
      If you experience any issues with GixSQL I'd suggest to check their docs and open an issue there: https://github.com/mridoni/gixsql

      What is the correct way to use psql?

      psql is a command line utility, so psql --help may be useful. Then try to connect to the DB using the same information as you do in COBOL to validate that this works in general.

       

Anonymous
Anonymous

Add attachments
Cancel