Highlighted
New Member.
10506 views

Connect with MySQL

How can i connect to a database and update its tables from my AcuCobol Program?

0 Likes
18 Replies
Highlighted
Micro Focus Contributor
Micro Focus Contributor

RE: Connect with MySQL

Hi Giorgos,

You can use Embedded SQL statements and AcuSQL or you can use Acu4GL for ODBC

to work with your ACUCOBOL-GT application and MySQL.

You will find more info about the products here:

www.microfocus.com/.../index.aspx

You can contact me at: dominique.sacre@microfocus.com

Regards,

Dominique

0 Likes
Highlighted
New Member.

RE: Connect with MySQL

We do have the AcuSQL but i still cannot connect to my remote MySQL server.

i use:

EXEC SQL CONNECT TO "minisys" END-EXEC

but i get the error:

SQL Error: SQLCODE -1

SQLSTATE 00000

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect with MySQL

Have you tried to use a product like sql*plus to execute the same SQL command?

Not an expert in MySQL, but I am guessing that there is some MySQL client software on the machine where the runtime resides? Or is the MySQL connection made through defining an ODBC DSN? If an ODBC DSN, please share you runtime configuration file entries.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: Connect with MySQL

i don't use acusql but in a Workshop i heard that there are sometimes Problems with "

i use adodb for db-connections

when i look to the sample code from the Workshop:

          if userid not = spaces

             EXEC SQL CONNECT TO :servername

                  as C1

                  USER :userid USING :passwd

             END-EXEC

          else

             EXEC SQL CONNECT TO :servername as C1

             END-EXEC

          end-if

and the sample in the acucobol Manual:

(55)   display "Making connection".

(56)   EXEC SQL CONNECT TO :dsn-name as C1

(57)      END-EXEC.

(58)   display "Connection made".

0 Likes
Highlighted
New Member.

RE: Connect with MySQL

what is runtime configuration file entries? i only know Data Source Configuration

0 Likes
Highlighted
New Member.

RE: Connect with MySQL

Like really did anyone used that AcuSQL?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Connect with MySQL

Have you tried our sample programs ...

C:\Program Files (x86)\Micro Focus\Acucbl9xx\AcuGT\sample\acusql\mysql .. the create.sqb would be a good place to start

0 Likes
Highlighted
New Member.

RE: Connect with MySQL

i do but i get an error of -1 when i try to connect.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: Connect with MySQL

have you tested to get an more detailed error-msg?

SQL Server Environments

In Microsoft SQL Server environments, the external variable F-ERRMSG is set to the full text of the error message returned to accommodate error messages longer than

70 characters.

F-ERRMSG is an external variable of USAGE POINTER that must be manipulated in order to see its contents. The following code demonstrates how to see the contents

of the error message string:

01 f-errmsg usage pointer external.

01 my-errmsg pic x(512).

....

0000-START.

EXEC SQL WHENEVER SQLERROR GO TO ERROR-EXIT END-EXEC.

....

ERROR-EXIT.

EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC.

DISPLAY "SQL ERROR: SQLCODE " SQLCODE

DISPLAY " SQLSTATE " SQLSTATE

DISPLAY SQLERRMC

call "c$memcpy" using my-errmsg, by value f-errmsg, 512.

display my-errmsg

ACCEPT OMITTED

STOP RUN.

where

f-errmsg is an external variable that contains the full text of the error message.

my-errmsg is the full text of the error message, which in this case can contain up to 512 bytes.

See Book 3, Reference Manual, of the ACUCOBOL-GT documentation set for information on C$MEMCPY and USAGE POINTER

0 Likes
Highlighted
New Member.

RE: Connect with MySQL

but i use AcuSQL for MySQL database.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: Connect with MySQL

this is from the AcuSQL User's Guide 2.9!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.