Here you replace the COBOL source in the TemperatureConverter.cbl file with COBOL source that accesses the SQL Server database.
$set sql(dbman=jdbc)
class-id com.microfocus.converter.TemperatureConverter public.
01 text1 pic x(10). *> to force implements IObjectControl
exec sql include sqlca end-exec.
method-id toCelsius.
procedure division using by value fahrenheit as float-short returning celsius as float-short.
exec sql connect to pubs end-exec.
exec sql
select (:fahrenheit - 32) * 5 / 9 into :celsius
end-exec.
exec sql disconnect pubs end-exec.
goback.
end method.
method-id toFahrenheit.
procedure division using by value celsius as float-short returning fahrenheit as float-short.
exec sql connect to pubs end-exec.
exec sql
select (:celsius * 9 / 5) + 32 into :fahrenheit
end-exec.
exec sql disconnect pubs end-exec.
goback
end method.
end class.