Skip to main content

Because  one of our providers does no longer support ORACLE, I must use SQL-server from Microsoft.

Is it possible to use in one program embedded ORACLE and Microsoft SQL-server.

When it is possible, where can I find documentation about it,

Because  one of our providers does no longer support ORACLE, I must use SQL-server from Microsoft.

Is it possible to use in one program embedded ORACLE and Microsoft SQL-server.

When it is possible, where can I find documentation about it,

This would be possible only if you were using the OpenESQL precompiler for your embedded SQL and not if you were using Oracle's Pro*COBOL.

If you created two DSN's, one using Oracles ODBC driver and another using the SQL Server ODBC driver then you could connect to both in a single application and then switch between the two using EXEC SQL SET CONNECTION statement.

The documentation for OpenESQL can be found here:

Example connecting to SQL Server and DB2 in one program using named connections.

       *> Connect to SQL Server DSN that uses Windows authentication
          
           exec sql
              connect to 'SQLODBC32WA' as SQLSVRCONN
           end-exec
     

    *> Connect to DB2


           exec sql
              connect to 'DB2ODBC32' as DB2CONN
           end-exec
          
           exec sql set connection SQLSVRCONN end-exec
          
           move "ANTON" to Customers-CustomerID
           exec sql
              select
                 A.CompanyName
                ,A.ContactName
                ,A.Phone
              into
                :Customers-CompanyName
               ,:Customers-ContactName:Customers-ContactName-NULL
               ,:Customers-Phone:Customers-Phone-NULL
              from Customers A
              where (A.CustomerID = :Customers-CustomerID)
           end-exec
          
           display Customers-ContactName
           display Customers-CompanyName
           display Customers-Phone
          
           exec sql set connection DB2CONN end-exec
          
           move "000030" to employee-empno
           exec sql
              select
                 A.FIRSTNME
                ,A.LASTNAME
                ,A.PHONENO
              into
                :EMPLOYEE-FIRSTNME
               ,:EMPLOYEE-LASTNAME
               ,:EMPLOYEE-PHONENO:EMPLOYEE-PHONENO-NULL
              from CRG.EMPLOYEE A
              where (A.EMPNO = :EMPLOYEE-EMPNO)
           end-exec
          
           display employee-firstnme
           display employee-lastname
           display employee-phoneno
           
           exec sql disconnect all end-exec


Because  one of our providers does no longer support ORACLE, I must use SQL-server from Microsoft.

Is it possible to use in one program embedded ORACLE and Microsoft SQL-server.

When it is possible, where can I find documentation about it,

Thanks for the answere.

I have to use SQL-server on a Windows platform.

Some questions :

1)

Can I use the same

          exec sql

             connect to 'DB2ODBC32' as DB2CONN

          end-exec

and

          exec sql disconnect all end-exec

or is it another connect/disconnect string I have to use.

2)

What are the directives in stead of  COBSQL

3)

The SQLCA.cpy  is special for ORACLE.

Which copybook can I use in stead of the SQLCA.cpy

4)

Are there more "things" I have to change in the program

Because I am the only person who use Micro Focus Net Express , I cannot ask other persons this questions.


Because  one of our providers does no longer support ORACLE, I must use SQL-server from Microsoft.

Is it possible to use in one program embedded ORACLE and Microsoft SQL-server.

When it is possible, where can I find documentation about it,

The same connection syntax can be used to connect to SQL Server.

The name that I used in the example can be any name that you choose where the name after the connect to is the actual name of the DSN that you create using the Windows ODBC Administration tool.

The connection name used after the AS can be any name that you wish to give it as well.

The compiler directives to use for turning on OpenESQL are specified using the SQL directive.
SQL(DBMAN=ODBC).

A full list of OpenESQL directives and the OpenESQL documentation can be found here:

OpenESQL uses its own version of the SQLCA and this resides in the folder:
C:\\Program Files (x86)\\Micro Focus\\Net Express 5.1\\Base\\SOURCE

It will be brought in automatically when you have the statement:
     EXEC SQL INCLUDE SQLCA END-EXEC
in your programs working-storage section.

Oracle Pro*COBOL and OpenESQL are not completely compatible products.
The following should be considered before moving from Pro*COBOL to OpenESQL:

  • OpenESQL is not a direct replacement for the Oracle Pro*COBOL precompiler and does not include functionality for many Oracle extensions
  • Customers should review usage of Oracle specific extensions before moving to OpenESQL. Oracle precompiler directive FIPS can assist in identifying non-ANSI usage
  • Customers may need to modify EXEC SQL code that uses non-ANSI extensions before using OpenESQL

Thanks.