Re: Embedded SQL, PL/SQL in Cobol
- From: "Chris" <ctaliercio@xxxxxxxxx>
- Date: 28 Apr 2005 10:27:29 -0700
Jeff,
Here is a very basic sample that will connect to an Oracle database.
You can always expand the EVALUATE statement to include other various
SQLCODEs so that you can incorporate your own error messages if
desired. Also, you'll need to run this with the Oracle run-time
(rtsora) or build a shared library that you make an initial call to in
order to load the Oracle functions.
Good luck.
Chris
identification division.
program-id. dbconnect.
data division.
working-storage section.
exec sql include sqlca end-exec.
exec sql declare dbname database end-exec.
exec sql begin declare section end-exec.
01 db-user pic x(10).
01 db-passwd pic x(10).
exec sql end declare section end-exec.
procedure division.
move "myLogin" to db-user
move "myPassword" to db-password
exec sql
connect
:db-user
identified by
:db-passwd
at
dbname
end-exec
evaluate sqlcode
when 0
display "You are connected!" end-display
when other
display "Error: " sqlerrmc(1:sqlerrml - 1)
end-display
end-evaluate
goback returning 0
.
.
- Follow-Ups:
- Re: Embedded SQL, PL/SQL in Cobol
- From: Jeff
- Re: Embedded SQL, PL/SQL in Cobol
- References:
- Embedded SQL, PL/SQL in Cobol
- From: Jeff
- Embedded SQL, PL/SQL in Cobol
- Prev by Date: Re: Age of conset (was: OT - "lie" vs "error"
- Next by Date: Re: OT - "lie" vs "error"
- Previous by thread: Embedded SQL, PL/SQL in Cobol
- Next by thread: Re: Embedded SQL, PL/SQL in Cobol
- Index(es):
Relevant Pages
|
|