Is it possible to get the functionality of autonomous stored procedure in DB2 z/OS 10?
Scenario is: attempt to execute given stored procedure must logged to our logs table even if the procedure ended with exception (rollback was performed).
I was going to use autonomous stored procedure for that, but in z/OS it was introduced in version 11...
Please note that I am not able to change the database setup, unless it's absolutely necessary. If you worked with years-old mainframe monstrosities, you understand.
You could simulate (Actually, this is the way autonomous SPs works in LUW) the autonomous option by calling an external stored procedure (in C or Java) that creates another connection to the database and call the "autonomous" SP.
By recreating the connection from an external SP, you will have the isolated environment to execute the "autonomous" part.
I wrote an article in my blog about autonomous SP in LUW: http://angocadb2.blogspot.com/2014/05/autonomous-transactions.html
Related
How to trace all events for service firebird server with delphi xe10?
This is my code:
my := TIBControlService.Create(Self);
my.ServerName := '127.0.0.1/3050';
my.Protocol := TProtocol.TCP;
my.LoginPrompt := false;
my.TraceFlags := [tfQPrepare, tfQExecute, tfQFetch, tfError, tfStmt, tfConnect, tfTransact, tfBlob, tfService, tfMisc];
my.Params.Add( 'user_name=SYSDBA' );
my.Params.Add( 'password=masterkey' );
// -----
mh := MonitorHook;
mh.TraceFlags := my.TraceFlags;
Self.IBSQLMonitor1.TraceFlags := my.TraceFlags;
mh.RegisterMonitor(Self.IBSQLMonitor1);
Self.IBSQLMonitor1.Enabled := true;
Memo1.Lines.Add( Format('GetMonitorCount: %d',[mh.GetMonitorCount]) );
my.Attach;
Memo1.Lines.Add( Format('Active: %s',[System.StrUtils.IfThen(my.Active,'yes','no')]) );
and
procedure TForm1.IBSQLMonitor1SQL(EventText: string; EventTime: TDateTime);
begin
Memo1.Lines.Add(EventText);
end;
Result:
GetMonitorCount: 1
Active: yes
[Application:]
:[Attach]
[Application:]
:[Query]
But this result is only from my application. When I connecting from another proces (ex.isql) my application not show this event.
When talking about Interbase/Firebird the term EVENT has a very specific meaning, the specific SQL command that sends text constants to clients, who subscribed to those.
See http://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-psql-coding.html#fblangref25-psql-postevent
However, the client should subscribe to the exactly the same text string, as posted by PSQL block. There were talks about enabling masks-based subscription, which would potentially made it possible to subscribe to all SQL events, like *.* matches all files in Windows, but for the best of my knowledge they never materialized.
That is what "event" means in Firebird, but it does not seem that is what you mean, instead it looks you want to monitor all the kinds of activity flowing between the SQL server and all the applications, starting with SQL commands and more.
If so, then there is no way to do it in general. You have to decide what exactly and why exactly do you want, and maybe there will be some partial solutions.
Firebird 2.5 introduced the so called Trace API, which allows you to subscribe to SOME of actions and be notified of them. This tends to introduce a significant load on the engine though, depending on how vague your subscription filters would be and how many requests the server receives - it might increase RAM and CPU usage up to total unusability.
The kinds of activity that can be subscribed for are limited. For example the process of reading BLOBs is not monitored. When I asked - I was struggling with the infamous "Invalid BLOB id" that was triggered by Delphi dbExpress library quirk - i was told that "no one ever needed this, and you have little reasons to need it too. You made a demo project, sent it to us - and we explained the behavior for you". THAT time having BLOBs access tracing would help me a lot, but to be objective, that was one and the only case I really needed it.
You might take a look at what you can get in general with Firebird Trace Manager - a CLI utility that is part of FB distribution, starting with 2.5.
You might take a look at Firebird Profiler, a free simplistic GUI tool from http://fbprofiler.sf.net
Commercial DB IDEs for Firebird, like IBExpert or UpScene TraceManager and probably others too, usually have Trace API support.
You may do your own implementation, using Trace API, starting with Program Files\Firebird\Firebird_2_5\doc\README.trace_services.txt and Program Files\Firebird\Firebird_2_5\include\ibase.h. It may also happen that 3rd party libraries like Unified Interbase or IBObjects have translated the API to Delphi. I think i saw something about trace in UIB but i am not sure. I would not expect though such a library to be part of Delphi distribution: from Delphi standpoint Firebird is direct competitor to their Interbase and IBX library would hardly have interest to diverge from their own Interbase by supporting Firebird-only functions.
Provided you only care about native applications like Delphi you might decide to make your own interposer fbclient.dll and install it on all the client computers instead of stock DLLs. Same for legacy-emulating GDS32.DLL, if used by your apps.
This DLL should totally provide all the API calls, both classic ones described in IB6 documentation at http://firebirdsql.org/en/reference-manuals/ with all the post-IB6 updates, and the new Firebird 3 "object oriented API".
It should log the calls in a way of your choosing, and then should proxy the call to the copy of original client DLL that you will hide for it with different file name. It should be installed instead of the standard client DLL on every computer you care to intercept and monitor.
It should not be very hard with the classic API, people were doing this, though did not publish. But the new ooAPI might be challenging.
It will only intercept applications, working through the fbclient.DLL interface. Java applications using Jaybird and C# applications using .Net Provider libraries would probably use underlying wire protocol skipping the fbclient.dll and thus your interposer too.
I have an application in my company. I want to convert it from BDE to ADO Connection.
I searched almost everywhere, I did not find any good answer.
The AIM IS
Convert that BDE connection to ADO connection but we need to use TQuery component to fetch data from database.
So, it will look like we are using BDE but internally it uses ADO Connection.
So, please answer this question you cant imagine, how thankful i will be.
... if somehow we can set the database Alias to ADO connection ...
Just take a look at the source code of Delphi's BDE and ADO support (in e.g. DBTables.Pas and ADOInt.Pas + ADODB.Pas and you will soon see that they are as different as chalk and cheese.
You have no hope of e.g. using a TAdoConnection via the BDE from a Delphi app.
What you could do is do move your data to an ADO database (e.g. MS Sql Server) and then create a) a System DSN to connect to the ADO db via ODBC and then b) set up a BDE Alias that uses the BDE alias and c) change your existing BDE app to use the new alias instead of the one it currently uses. That way, you can continue using your existing app to access the ADO version of the data via TTable, TQuery etc and develop a parallel TAdo-component based equivalent at your leisure.
You could easily try this out using the traditional Delphi MastApp or "Fish Facts" demo application and data. Getting your existing BDE app to access an ADO-compatible copy of your data via an ODBC alias should not be more than a day's work even if you have never done it before. Actually converting your BDE app to ADO would likely take rather longer, though.
There are countless examples of different ways of copying BDE (e.g. Paradox) data to ADO data on the internet. Try looking at a few.
I am new to stored procedures, informix, and UCCX. I am working on a project to consolidate reporting into on BI tool, and it appears there are several UCCX stored procedures that could be great time savers for bringing the UCCX historical reporting into our BI tools. Can anyone offer tips on how to query stored procedures for informix via RazorSQL?
You are on the right track with your syntax. For example, I can call a different stored procedure by executing the following in RazorSQL:
execute procedure sp_agent_state_detail('2016-05-31 05:00:00','2016-05-31 05:59:59','0',null,'David Bowie',null,null)
The error you get is self-explanatory -- there is no calls_handled table. I suspect that the gettotalcalls() stored procedure is meant to be used in conjunction with some other code, perhaps another stored procedure, that creates that table.
Quick disclaimer: I'm a .Net developer and may not have provided all the information you need about the environment, but can get the information on request. We have COBOL programmers, but they have never done this.
We are converting a mainframe application with a DB2 database to a .Net MVC application with SQL database. There is one mainframe COBOL batch program that we would like to call from a COBOL stored procedure on the DB2. I've read this can be done, but I haven't found a good example of how to create a COBOL stored procedure that calls a COBOL program. The COBOL batch program takes about 5 input parameters, but does not return anything.
We already have a linked server that we are using to call native sql stored procedures on DB2 from a SQL server.
Edited for future reference below
We looked into two ways of solving our problem - creating a COBOL stored procedure that could be used by DB2-mainframe running on z/os where we'd copy/paste our COBOL from the CICS program and tweak it to run as a stored procedure (thus cutting out CICS completely) or using CICS to host a web service end point that can call to the CICS program we wanted to invoke, much like described on slide 21 of this PowerPoint.
We have decided to move forward with the second option because there is precedent for doing it that way already, so it's going to be the easier path for us.
Interesting question!
I was thinking of why not let your LUW DB2 stored procedure call a transaction manager which will execute your cobol program? This if you use a transaction manager in mainframe (which I assume you do!). If you are not familiar with this, just check your mainframe guys if you use transaction manager as CICS or IMS.
I have not done this, but it should work.
(alternative, call a http/webservice from db2 sp which will execute an ims transaction that executes your cobol program...)
I must add that I ve not tried any of above, I haveĀ“nt used db2 luw. But maybe the ideas are worth to mention here?
I'm attempting to fix some problems with some old VB6 code for a client, and the previous programmer used Activex Data Object 2.7 stored procedures. After a recent computer failure and reimage, none of the buttons that use stored procedures in the application currently work.
So, my question is where can these procedures be stored?
Thanks
Stored procedure are on the database. Unless the database was on the local machine, there are only a few things of which I can think that could have been broken/reset by a re-image.
These are all used to remap computer name references.
HOSTS
DSN
SQL Aliases