Skip to main content

Working with SQL Database in Managed COBOL

  • December 11, 2020
  • 3 replies
  • 1 view

Alexander Castro

I would like to learn how to connect, read and modify an SQL database in Managed COBOL. I have created a simple sql database in Microsoft SQL Server Management Studio v 18.7.1. Is there documentation and/or a sample program available for beginners?

3 replies

Chris Glazier
Forum|alt.badge.img+2

I would like to learn how to connect, read and modify an SQL database in Managed COBOL. I have created a simple sql database in Microsoft SQL Server Management Studio v 18.7.1. Is there documentation and/or a sample program available for beginners?

If you are referring to using embedded SQL statements within your programs using OpenESQL then working with SQL in managed COBOL is done the same way as it is in native COBOL. Instead of using ODBC DSNs for your connections you instead use ADO.NET DSNs for .NET and JDBC DSNs for JVM COBOL. For .NET there are also some extended statements that use EXEC ADO instead of EXEC SQL.

There are some examples available in the Samples browser, click Show .NET COBOL only (or JVM COBOL) from the drop down and then select SQL as the topic in the left hand pane and then you will be presented with a list. Any that begin with OESQL apply.

There are also some videos in the Visual COBOL in a Nutshell series that go over individual topics in greater detail. The Playlist can be found here.


Alexander Castro
  • Author
  • Participating Frequently
  • December 12, 2020

If you are referring to using embedded SQL statements within your programs using OpenESQL then working with SQL in managed COBOL is done the same way as it is in native COBOL. Instead of using ODBC DSNs for your connections you instead use ADO.NET DSNs for .NET and JDBC DSNs for JVM COBOL. For .NET there are also some extended statements that use EXEC ADO instead of EXEC SQL.

There are some examples available in the Samples browser, click Show .NET COBOL only (or JVM COBOL) from the drop down and then select SQL as the topic in the left hand pane and then you will be presented with a list. Any that begin with OESQL apply.

There are also some videos in the Visual COBOL in a Nutshell series that go over individual topics in greater detail. The Playlist can be found here.

Chris, thank you for that information!

Claude Greiner
  • Participating Frequently
  • December 12, 2020

I would like to learn how to connect, read and modify an SQL database in Managed COBOL. I have created a simple sql database in Microsoft SQL Server Management Studio v 18.7.1. Is there documentation and/or a sample program available for beginners?

many examples are in "Visual Cobol Forum", also in "Netexpress Forum", also by microfocus examples!
Easy to use, great working, what is your intution?