Re: Cobol MS-Access
- From: "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Feb 2009 16:05:09 +1300
James J. Gavan wrote:
foxgrove@xxxxxxx wrote:<snipped examples of accessing MS Excel via OLE and MS ACCESS via ODBC using
Micro Focus COBOL.>
The consideration that needs to be examined here is how important efficiency
is to the end result.
While I wouldn't agree that either of the solutions offered is "ugly",
neither of them is particularly "elegant" either.
ODBC is flexisble and allows connection to any database that provides an
ODBC driver, sometimes without requiring any change to the COBOL code, BUT
it is NOT efficient (compared to other options).
Cursors in ODBC hold the DB connection for as long as the cursor is open.
This can have a very serious effect on throughput where multiple databases
are being accessed from multiple terminals. New connections may have to wait
to obtain a connection and this can be a "bottleneck" which degrades
overall system throughput. This factor alone is a major one in the
deprecation of Embedded SQL (ESQL). (Many programmers see ESQL as being
obsolete, replacing it with multiset constructs and triggered stored
procedures...There are some very compelling arguments for doing this
anyway...)
Automation (OLE originally, now COM) provides platform independent access
and (for MS ACCESS in particular, but not exclusively) enables the use of
DAO or ADO, both of which are many times more efficient than ODBC. ADO can
be used with a number of databases besides MS-ACCESS and it runs a single
query which returns a resultset, then disconnects. Connections are held for
milliseconds rather than minutes and the resultset is processed in memory.
DAO, although deprecated by Microsoft in favour of ADO, is a "no frills"
package which runs very efficiently with ACCESS. You can run ADO and DAO
from COBOL but you will need to use COM/OLE to establish easy communication
with these subsystems. (COM is not the ONLY way but it is probably the best
way for COBOL...)
I tried using ADO with dynamic SQL from COBOL and found that even with the
dynamic PREPAREs it was STILL considerably faster than ESQL across ODBC.
These days I use LINQ with C# to access databases and I have no intention of
going back to ESQL and ODBC; it is simply a different world.
The point of my post is that before we label anything as "ugly" we should
look at the context it is intended for. Many things that we think are
"cool", in a broader context can be seen to be not so...
Pete.
--
"I used to write COBOL...now I can do anything."
.
- Follow-Ups:
- Re: Cobol MS-Access
- From: Richard
- Re: Cobol MS-Access
- From: Michael Mattias
- Re: Cobol MS-Access
- From:
- Re: Cobol MS-Access
- References:
- Cobol MS-Access
- From: JC
- Re: Cobol MS-Access
- From: foxgrove
- Re: Cobol MS-Access
- From: James J. Gavan
- Cobol MS-Access
- Prev by Date: Re: z/OS Cobol source libraries
- Next by Date: Re: Fujitsu NetCobol 8.0
- Previous by thread: Re: Cobol MS-Access
- Next by thread: Re: Cobol MS-Access
- Index(es):
Relevant Pages
|