Highlighted
Absent Member.
Absent Member.
2248 views

Connecting to MySQL

Jump to solution

Hi there,

I'm connecting to a MySQL db from Visual COBOL on Windows 10 and have a few questions I'm hoping someone can help with.

I have watched Chris Glazier's useful MF video, 'Database Access Using ODBC with Visual COBOL' .

(1) I'm assuming 32 bit throughout? I am using defaults in VC which I believe is 32 bit?

(2) When setting up my ODBC DSN I have the option of a 'unicode' MySQL 32-bit driver or an 'ansi' one. Which should I use and why?

(3) Simplest db sign-in? In our Windows production environment we have (a) standalone machines,  (b) server/client and (c) servers with users connecting with RDT. Is it easier to use built-in windows automatic security or have a specific MySQL username and password which is then specified in the programs. Simplifying deployment is my aim.

(4) In a Windows production server/client environment... is (a) the odbc driver needed on each client machine, (b) with an odbc dsn pointing from the client to the server MySQL db?

(5) Are there other MF videos you would suggest to help with Visual COBOL SQL db access. I will be using MF OpenESQL

Thank you in advance. I imagine I'll have more questions as I go!

Best wishes,

Linden

 

 

  

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Linden,

I am glad that you found the video to be useful to you.

The default project type for native projects is x86 which is 32-bit. This means that the ODBC DSN that you need to use must also be 32-bit. You can create this using the ODBC Datasource Administrator (32-bit) which can be found under the start menu Micro Focus Visual COBOL->Data Tools-->Data Connections group.

The version of the ODBC driver that you use depends on the type of data you wish to access in your program, If you are storing data as Unicode characters, (2 byte characters) then you would need to use the Unicode version of the driver and access these fields using PIC N host variables. If you are using single byte ANSI characters (PC character set) only then you can use the ANSI driver and return the data into PIC X host variables.

For OpenESQL you are required to have an ODBC driver and your DSN installed on each workstation on which the application will be running.

There are a number of other videos in the same series as the ODBC one that you watched which cover various aspects of OpenESQL such as cursors, dynamic SQL, OpenESQL Assistant etc.

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Linden,

I am glad that you found the video to be useful to you.

The default project type for native projects is x86 which is 32-bit. This means that the ODBC DSN that you need to use must also be 32-bit. You can create this using the ODBC Datasource Administrator (32-bit) which can be found under the start menu Micro Focus Visual COBOL->Data Tools-->Data Connections group.

The version of the ODBC driver that you use depends on the type of data you wish to access in your program, If you are storing data as Unicode characters, (2 byte characters) then you would need to use the Unicode version of the driver and access these fields using PIC N host variables. If you are using single byte ANSI characters (PC character set) only then you can use the ANSI driver and return the data into PIC X host variables.

For OpenESQL you are required to have an ODBC driver and your DSN installed on each workstation on which the application will be running.

There are a number of other videos in the same series as the ODBC one that you watched which cover various aspects of OpenESQL such as cursors, dynamic SQL, OpenESQL Assistant etc.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Thanks Chris for your full answer as always. Regards, Linden

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
Highlighted
Absent Member.
Absent Member.
Hi Chris

Can you please make a video 'DB2 Database Access Using ODBC with Visual COBOL'?

Thanks
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert
Hi,

Accessing DB2 through an ODBC driver is done in the same manner as other databases such as SQL Server or Oracle when using their ODBC drivers. You would use the SQL(DBMAN=ODBC) directive and set up a DSN for your DB2 driver.

The biggest issue you would face is compatibility with existing DB2 applications that are run on the mainframe as the syntax can be different from what is provided with the OpenESQL precompiler which is based on the ANSI SQL standard.

If you required closer compatibility to mainframe syntax then you would use the DB2 directive instead of the SQL directive and then the precompiler would interface with the IBM DB2 libraries directly instead of going through ODBC.

I will add DB2 Database Access to my list of future videos.

Thanks.
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.