Windows 11
Installed : Gix-IDE using gixsql-installer-windows-x64-mingw-1.0.20-1.exe
I launched Gix-IDE and tried to connect to a local PostgreSQL database using a sample file test001.gix as a reference. The build completes successfully, but when I run the program, it seems to stop at the line:
CONNECT TO :DBNAME USER :DBAUTH
After this line, nothing happens.
There is no SQLCODE returned, and no logs or error messages are displayed either.
I'm currently stuck and unsure how to establish a proper database connection.
If anyone has experience with this or any suggestions, I would greatly appreciate your guidance.
Those aren't EXEC SQL but have to be specified before the first EXEC SQL - but you can use the DISPLAY UPON / ACCEPT FROM syntax which is used otherwise in this example as well .
Last edit: Simon Sobisch 2025-10-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome to the forum!
First thought is that you may need to create a separate user for your database. And use that user in the program.
On Linux a superuser is not allowed to access PostgreSQL tables and your userID may be the issue. Not sure how Windows does this.
I will post how I did things.. soon today.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is my info on how I did run on Linux. Not sure if it will help on Windows.
My Linux Install and Compiling PostgreSQL GnuCOBOL programs.
Simon gave me this info to install manually:
wget https://github.com/mridoni/gixsql/releases/download/v1.0.20b/gixsql-1.0.20b.tar.gz
sudo apt install libpq-dev flex libspdlog-dev libfmt-dev
you may add libmariadb-dev unixodbc-dev if you additional want support for MariaDB (MySQL) and/or ODBC to the install.
Then I just did the tar and ./config and make make install.... usual.
I had some issue on the copybook for SQL so I put them in my library where my copybooks are: ( yes I need to clean that up )
mickeyw@mickeyw-Meerkat:~/cpy$echo$HOME/cpy
/home/mickeyw/cpy
# and extract of the list I think it used:
-rw-r--r--1mickeywmickeyw1003Aug1812:07sqlca.cpy
-rw-r--r--1mickeywmickeyw2737Aug1812:07sqlda.cpy
-rw-r--r--1mickeywmickeyw1003Sep511:07SQLCA
-rw-r--r--1mickeywmickeyw2737Sep511:08SQLDA
-rw-rw-r--1mickeywmickeyw479Sep715:44customer
-rw-rw-r--1mickeywmickeyw479Sep716:33CUSTOMER
Note: I use dynamic subroutines but I did add to my COB-PRE-LOAD environment variable:
This is the gixsql compile line I used: gixsql test002.sqb test002.cbl -I "$HOME/cpy/" && cobc -x test002.cbl
Note: I do not like EXIT and prefer no goto or perform thru exit, but I had to have the end of the program NOT be the end of the SQL... probably just me..
Here is my test002 program that makes the connection and selects the count on the table:
Note: when I run my cobol sql program PostgreSQL creates a log file, if there were SQL errors, that was Very helpful when trying to analyze connection or SQL issues:
gixsql.log
It is in the same directory that I ran my program in...
BELOW is the information I have on my database and table. I have one db and it has one table. I manually created them. I have a test file with 1001 records that I manually loaded to the table.
Also you can see that I created a user ( james ) to access the tables as Linux and PostgreSQL may have issues with my mickeyw user name as it is a superuser.
I guess that you did assign the new user permissions , GRANT CONNECT TO newuser ;
and GRANT SELECT ON your_table TO newuser;
Note I have PostgreSQL version 16 ( and ver 14 on an older OS) both work.
Have you tried compiling outside of the IDE ?
I also had issues with the TEST001.sqb program that was on the site.
I got it to work in this example:
Maybe you could try this example.
Note it ran for me.
If you have connection problems, did you find the gixsql.log file?
Here is the log file if I run with invalid user id in the program after it abends.
Hi, maybe you could edit the file pg_hba.conf of the PostgreSQL server like this:
# TYPE DATABASE USER ADDRESS METHOD
# standard for local connections
local all postgres peer
# first this for database user cobol_user (local and TCP/IP)
local all cobol_user md5
host all cobol_user 127.0.0.1/32 md5
host all cobol_user ::1/128 md5
[...] then all the other stuff ...
And then restart the postgresql-service...
This was the last missing piece for me to get a connection of my user "cobol_user" on localhost via GixSQL ...
The concrete PostgreSQL version (14 ... 18) doesn't matter I think.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I forgot that. It was one of the fixes for me also!
update: After reviewing my notes, I only had to do that one system, one has : Local All All Peer and the other: Local All All md5
Last edit: Mickey White 6 days ago
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,! Michael Del Solio,
It seems that the PostgreSQL version doesn’t really matter…
I tried changing the pg_hba.conf settings!
Mickey White, Thank you for the sample code.
When I followed the README instructions in the command prompt, I was able to successfully verify the SQL connection :-).
Now, I just need to make sure that building and running from GixIDE returns the correct results…
I just remembered that I had installed MinGW during the initial setup, so I reinstalled it using MSVC instead. After that, I was able to successfully build and run the project. I apologize for the trouble I caused, and I truly appreciate everyone’s help in getting it to work!
Environment:
Windows 11
Installed : Gix-IDE using gixsql-installer-windows-x64-mingw-1.0.20-1.exe
I launched Gix-IDE and tried to connect to a local PostgreSQL database using a sample file test001.gix as a reference. The build completes successfully, but when I run the program, it seems to stop at the line:
CONNECT TO :DBNAME USER :DBAUTHAfter this line, nothing happens.
There is no SQLCODE returned, and no logs or error messages are displayed either.
I'm currently stuck and unsure how to establish a proper database connection.
If anyone has experience with this or any suggestions, I would greatly appreciate your guidance.
As that is very early I'd enable the full logging and check its output
https://github.com/mridoni/gixsql?tab=readme-ov-file#logging
This can be set from the program before the very first call to any GixSQL function as well:
SET ENVIRONMENT "GIXSQL_LOG_LEVEL" TO "debug"And also check the plain connect to the databese on your machine outside of COBOL.
@jamesbwhite has setup this recently (not with the GixIDE, only with GixSQL, but that doesn't matter)
Last edit: Simon Sobisch 2025-10-24
Hi. Mr.Simon.
Thank you for your response.
I enabled logging and obtained the following output:
Also, I have confirmed that I can connect to the database from psql outside of the COBOL program.!
OK, that looks like a good start, I'd suggest to set the log level to
trace.And just to check that the encoding is not an issue, try
SET ENVIRONMENT "GIXSQL_CLIENT_ENCODING" TO "SJIS"as well (GixSQL defaults to UTF8).I set the log level to "trace" and ran it.
Then I added the encoding setting and ran it again.
Those aren't
EXEC SQLbut have to be specified before the firstEXEC SQL- but you can use theDISPLAY UPON / ACCEPT FROMsyntax which is used otherwise in this example as well .Last edit: Simon Sobisch 2025-10-24
Sorry,
It’s partly my misunderstanding, but I’m not really sure where or how exactly I should add it.
If it’s okay, could you provide a sample code for me?
Thanks!
I added the sample and ran it, but didn’t notice any changes in the logs.
I’m wrapping up for today, so I’ll continue working on this on Oct 27.
Welcome to the forum!
First thought is that you may need to create a separate user for your database. And use that user in the program.
On Linux a superuser is not allowed to access PostgreSQL tables and your userID may be the issue. Not sure how Windows does this.
I will post how I did things.. soon today.
Here is my info on how I did run on Linux. Not sure if it will help on Windows.
My Linux Install and Compiling PostgreSQL GnuCOBOL programs.
Simon gave me this info to install manually:
wget https://github.com/mridoni/gixsql/releases/download/v1.0.20b/gixsql-1.0.20b.tar.gz
sudo apt install libpq-dev flex libspdlog-dev libfmt-dev
you may add libmariadb-dev unixodbc-dev if you additional want support for MariaDB (MySQL) and/or ODBC to the install.
Then I just did the tar and ./config and make make install.... usual.
I had some issue on the copybook for SQL so I put them in my library where my copybooks are: ( yes I need to clean that up )
Note: I use dynamic subroutines but I did add to my COB-PRE-LOAD environment variable:
COB_PRE_LOAD=/home/mickeyw/lib/mwoc.so:/usr/local/lib/libgixsql-pgsql.so:/usr/local/lib/libgixsql.soThis is the gixsql compile line I used:
gixsql test002.sqb test002.cbl -I "$HOME/cpy/" && cobc -x test002.cblNote: I do not like EXIT and prefer no goto or perform thru exit, but I had to have the end of the program NOT be the end of the SQL... probably just me..
Here is my test002 program that makes the connection and selects the count on the table:
Here is the output of the test002 program
Note: when I run my cobol sql program PostgreSQL creates a log file, if there were SQL errors, that was Very helpful when trying to analyze connection or SQL issues:
gixsql.log
It is in the same directory that I ran my program in...
BELOW is the information I have on my database and table. I have one db and it has one table. I manually created them. I have a test file with 1001 records that I manually loaded to the table.
Also you can see that I created a user ( james ) to access the tables as Linux and PostgreSQL may have issues with my mickeyw user name as it is a superuser.
And
Hope this helps.
Last edit: Simon Sobisch 2025-10-26
HI.! Mickey White
Thanks for the advice!
I tried running it with a new user, but nothing changed :(
Then I realized something — I’m using PostgreSQL version 18, the latest one.
Could it be that GixSQL doesn’t support version 18 yet?
What version of PostgreSQL is everyone else using?
I guess that you did assign the new user permissions , GRANT CONNECT TO newuser ;
and GRANT SELECT ON your_table TO newuser;
Note I have PostgreSQL version 16 ( and ver 14 on an older OS) both work.
Have you tried compiling outside of the IDE ?
I also had issues with the TEST001.sqb program that was on the site.
I got it to work in this example:
Maybe you could try this example.
Note it ran for me.
If you have connection problems, did you find the gixsql.log file?
Here is the log file if I run with invalid user id in the program after it abends.
Hi, maybe you could edit the file pg_hba.conf of the PostgreSQL server like this:
And then restart the postgresql-service...
This was the last missing piece for me to get a connection of my user "cobol_user" on localhost via GixSQL ...
The concrete PostgreSQL version (14 ... 18) doesn't matter I think.
Yes, I forgot that. It was one of the fixes for me also!
update: After reviewing my notes, I only had to do that one system, one has : Local All All Peer and the other: Local All All md5
Last edit: Mickey White 6 days ago
If anyone is running the GixIDE sample program “TEST001.gix” on Windows 11 with PostgreSQL, I’d really appreciate some advice.
Also, it would be great if you could share your system setup and environment settings. Thanks in advance!
Hi,! Michael Del Solio,
It seems that the PostgreSQL version doesn’t really matter…
I tried changing the pg_hba.conf settings!
Mickey White, Thank you for the sample code.
When I followed the README instructions in the command prompt, I was able to successfully verify the SQL connection :-).
Now, I just need to make sure that building and running from GixIDE returns the correct results…
I just remembered that I had installed MinGW during the initial setup, so I reinstalled it using MSVC instead. After that, I was able to successfully build and run the project. I apologize for the trouble I caused, and I truly appreciate everyone’s help in getting it to work!