Hello, I have been trying to use dbpre with Gnu Cobol 3.2.1 and MariaDB (Ubuntu 22.04 laptop) but having a few problems, can someone help me please?
Fixes I have used:
1. Mariadb libraries used: sudo apt install libmariadb-dev
2. Edite cobmysqlapi.c changed: cob_procedure_parameters to: cob_procedure_params (otherwise compile errors)
4. To compile cobmysqlapi.c used: gcc -I/usr/include/mariadb -c cobmysqlapi.c
5. Then: gcc dbpre.c -odbpre -O5 -ggdb
When trying to compile sample PCTB003B:
1. Copied copy book members into folder copybk
2. To compile used: ./dbpre PCTB003B -ts=3 -Icopybk
3. Then: cobc -x PCTB003B.cob cobmysqlapi.o -L/usr/include/mariadb -lmysqlclient
Get the following:
/usr/bin/ld: cannot find -lmysqlclient: No such file or directory
collect2: error: ld returned 1 exit status
Not able to find an alternative include library, so a little stuck. Help!
Thanks,
Iain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Piper,
OK thanks for looking at the problem.
I have been using SQLite3 but recently started using MySQL and got directed into installing MariaDB instead. Functionally the same but better maintained, I have read.
Any how, I'll do some more homework!
Thanks,
Iain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since OpenCobol is now Gnu-Cobol, i am going to change some names used by dbpre and the framework.
Everything which has POCTB (Pipers Open Cobol Tool Box) in it's name is changed to PGCTB (Pipers Gnu Cobol Tool Box).
This includes names of copybooks and their content too and affects too your already written *.scb programs for using them with dbpre.
Is all this now completed?
Just got round to playing with it.
Now to try and change a SQL DAL from MS SQL to MySQL!!
It should be ok now, the main reason for this was to get rid of the poctb prefix and replace it with pgctb (Gnu Cobol instead of Open Cobol).
Hello, I have been trying to use dbpre with Gnu Cobol 3.2.1 and MariaDB (Ubuntu 22.04 laptop) but having a few problems, can someone help me please?
Fixes I have used:
1. Mariadb libraries used: sudo apt install libmariadb-dev
2. Edite cobmysqlapi.c changed: cob_procedure_parameters to: cob_procedure_params (otherwise compile errors)
4. To compile cobmysqlapi.c used: gcc -I/usr/include/mariadb -c cobmysqlapi.c
5. Then: gcc dbpre.c -odbpre -O5 -ggdb
When trying to compile sample PCTB003B:
1. Copied copy book members into folder copybk
2. To compile used: ./dbpre PCTB003B -ts=3 -Icopybk
3. Then: cobc -x PCTB003B.cob cobmysqlapi.o -L/usr/include/mariadb -lmysqlclient
Get the following:
/usr/bin/ld: cannot find -lmysqlclient: No such file or directory
collect2: error: ld returned 1 exit status
Not able to find an alternative include library, so a little stuck. Help!
Thanks,
Iain
Hi Ian,
sorry for the late reply, just found your post here..
-lmysqlclient might be MySql specific, you have to find out how to compile COBOL programs with MariaDB (sorry, i have never used MariaDB).
Maybe searching the GnuCOBOL forum for MariaDB support or asking there for help is a solution
https://sourceforge.net/p/gnucobol/discussion/
Your problem is not a problem of using dbpre, it is how to compile and link COBOL programs with GnuCobol and MariaDB.
Piper
Hello Piper,
OK thanks for looking at the problem.
I have been using SQLite3 but recently started using MySQL and got directed into installing MariaDB instead. Functionally the same but better maintained, I have read.
Any how, I'll do some more homework!
Thanks,
Iain