OO4O and AQ Callback - Help - OO4O and Wizards(Archived)

Am using AQ (8.1.6). Looking for information on how to implement the callback functionality in VB 6.0...Documentation says that this possible but have found few examples...Have everything else working fine..
Ron Music 

Have you exported the appropriate COM interface from your code? You may want to bump up to latest 8.1 version (8.1.7) as well. There was a bug in the callback code w/8.1.5, maybe fixed in 8.1.6, for sure fixed in 8.1.7.
Mark Tomlinson 

Mark,
Thanks for a prompt response. I guess this is part of the confusion. Is the callback client a COM object that I build or is it part of the Oracle set of objects? In addition, if I am creating an ActiveX dll, could it be part of that or does it have to be separate? Sorry if these questions seem simplistic. This is my first attempt with VB and AQ. Your help and advice is greatly appreciated.
Ron Music 

You have to implement a COM interface in your application (or your own OLE object) that exposes the NotifyMe interface as described in the docs. You then use the MonitorStart method to have the object called asynchronously. If memory serves, the interface was:
void NotifyMe(LPDISPATCH)
and the LPDISPATCH pointer was a reference to an OraAQMsg object which contained the message payload.
Suppose you created your own COM object that exposed this interface and called it MyNotify. You then do something like this:
Dim MyQ as OraAQ
Dim Notifier as MyNotify
Dim DB as OraDatabase
Dim OraS as Object
.
. 'Connect to the RDBMS and init the session (code ommitted for brevity)
.
Set MyQ = DB.CreateAQ("TEST")
Set Notifier = new MyNotify
MyQ.MonitorStart(Notifer)
Then your object will have the NotifyMe method invoked as messages are dequeued.

Related

Where can i find the document or source of jCOM ?

Hi, I wanna talk to EJB beans from com coding with VisualC++ ,
but it's difficult to find out some document or source about VC com client
.
So , I am working very painful. who can help me ?
Thanks and sorry for my poor English.
Hi,
From the jCOM perspective accessing a java (or more specifically a WLS object -
an EJB in this case) is no different whether you use a VB or VC++ client.
However, as you've found, from the COM perspective the differences can be quite
evident.
The bottom line is you need to know how to construct IDispatch objects and use
them. You need to understand the basics of COM implementation. VB is nice in
this way since it takes care of all the ugliness for you. But at the same
time, you lose nearly all control over how these objects are created and/or
implemented. So there is a trade off to be made.
There is a nice write up on the Intrinsyc site
(http://www.intrinsyc.com/support/j-integra/doc/javafromcom/vc2java.html).
Alternatively you can check out the tutorials on the MS Developer documentation
sites. They have quite a number of COM examples.
But here's a very quick and dirty example:
HRESULT hr = CoGetObject(L"myserver:jndi:JCOMSrvrObjsBean",
0, IID_IDispatch, (void**)&ejbDisp);
if(hr){
//handle the failure here...
}
ejbHomeVar = new VARIANT();
OLECHAR *ejbMethName = L"create";
DISPPARAMS *p = new DISPPARAMS();
DISPID dispID;
p->cArgs=0;
p->cNamedArgs=NULL;
p->rgdispidNamedArgs=NULL;
p->rgvarg=NULL;
iDispatch->GetIDsOfNames(IID_NULL, &methodName, 1,
LOCALE_USER_DEFAULT, &dispID);
hr = iDispatch->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, p, ejbHomeVar, NULL, NULL);
Once you've created the ejbHome you can begin invoking on it the same way you
did to get the home in the first place. Only this time instead of using the
variant (ejbHomeVar) you'll use it's dispatch member ejbHomeVar->pdispVal.
But to reiterate, there is certainly more information about this on the MS and
intrinsyc sites.
I hope this helps.
dan
"sha.mo" wrote:
Hi, I wanna talk to EJB beans from com coding with VisualC++ ,
but it's difficult to find out some document or source about VC com client
.
So , I am working very painful. who can help me ?
Thanks and sorry for my poor English.

external procedure call: can you wrap a c++ lib in a c lib?

Hi Folks,
With Oracle 8.1.6, we're trying to wrap a mass of
c++ .so libs in a c function, to make them usable from
a PL/SQL procedure. So far it hasn't worked. Has anybody
done this? Is it do-able?
Thanks for your help, Tom. 
You are not wasting your time. It can be done...
In order to wrap C++ for use by C, you must write wrapper functions declared with 'extern "C"' linkage for every C++ method you intend to call directly from C. This must be done using a C++ compiler. Once linked into a new library, any C exectuable or C library should be able to link this new library and call the wrapper functions you have declared 'extern "C"'.
If you still need more help, I would advise you to post in a C++ language forum perhaps. Best of luck, not that you should need it though... -Ralph
Thanks Ralph! We had wrapped the calls, and can even
execute the c++ code from the library using a c stub
driver. So, you are saying that if a c stub can call
functions from our c++ so, then oracle should be able
to do the same. Which means we have another problem,
like not having the listener set up properly....
Ok, this give me firm direction. Thanks much, Tom.

Invoking a C# Component from a trigger

Hi,
I am interested in finding out if it is possible to access a C# object from within a trigger. I have a number of tables that contain fairly static information that I want to cache in a DataSet on the client machine to minimize the number of connections and database round trips. However, I need to know if the information in the table changes. I've got a basic CachedTable component working using the dbms_alert package (signal, register, waitone) but this requires an open connection to invoke the dbms_alert.waitone procedure to catch the signal (generated in a (IUD) trigger).
If I could invoke a C# method from the trigger then I could come up with some message based way to notify the client objects of the change in the table.
Thanks in advance,
Mike 
COM Automation is another product from Oracle that provides the option of a call out from Oracle database. There are two primary ways to tackle your problem,
1. Implement a COM wrapper around a .NET component and call this wrapper from the database trigger. See MSDN,
.NET Development -> Building Distributed Applications with .NET -> Architectural Topics -> Microsoft .NET/COM Migration and Interoperability
2. Use external procedures to call out to a DLL written in C, and invoke the .NET component from the DLL.
With the External DLL call method you mention I notice that there is a long pause before any data is returned (obviously whilst the server loads the DLL).
Is there any way of forcing the server to keep the DLL loaded to prevent this delay in getting data from the DLL's functions?

Trying to get started

I am trying to test ODP.NET against my Oracle 9i database using the connection sample provided by Oracle. I have added the Oracle references to my solution explorer and I can declare the OracleConnection object. The problem is my solution cannot reference any of the methods associated with the OracleConnection object. Is there a step that I am missing?
Thanks 
Do you have references to the Oracle.DataAccess.Client namespace at the top of your program? You'll need to reference the Oracle.DataAccess.Types namespace if you use any of the Oracle datatypes. 
Add the following line at the top of your source code, depending on which language you're using:
VB.NET:
Imports Oracle.DataAcccess.Client
C#:
using Oracle.DataAccess.Client;
You can also "import" or "use" the Oracle.DataAccess.Types to utilize ODP.NET Types.
Thanks for your help. I added the wrong reference to my solution. I'm up and running. 
Dan,if you would like, I have an ODP.NET implementation of the Microsoft Application Building Block (Data Access Block) that helps to speed up design time. If you would like I can send it to you. It is currrently in VB.NET, but the C# version will be done very soon as well. The classes are in a Class Library project and you simply reference the .DLL in your projects to access them. It works equally well for Windows, Web, Web Service or Windows Service applications. Let me know.
Scott 
Mr. Hunley,
I would be very interested in your port of the DAAB for ODP.NET. I had just downloaded the Nile 3.0 sample app and source from MSDN so I could begin my own port (Microsoft did a DAAB for their .NET Managed Provider for Oracle, but its only available through the Nile 3.0 sample app), when it occurred to me that Oracle or someone else may have done this work already. So, here I am searching through OTN and found your posting. Do you only provide the DLL, or can you include the source code as well? I don't mind it being in VB.NET as that is the standard .NET language I've been told to use.
I realized that this message has been posted for awhile. But I was wondering if you could send me your conversion of the DAAB for ODP.NET. My address is trihouse#hotmail.com. Thanks in advanced. 
Hallo,
i have include the row "using Oracle.DataAccess.Client;" in my c# source and i become the error "The type or the namespace Oracle...... could not be found" ?!
Whats the mistake ? 
Did you add a reference to the ODP to the project?
- Mark
===================================================
Mark A. Williams
Oracle DBA
Author, Professional .NET Oracle Programming
http://www.apress.com/book/bookDisplay.html?bID=378 
Hi, I realise that you wrote this post a long time ago, but I would be really interested in seeing your ODP implementation of the Data Access Block.
Thanks in advance,
Rupert 
Oops, meant to say my email is rdbates#ssp-uk.com 
scott,
i would love to get ahold of that DAAB for c#... is that finished yet?
thank you!
kyle
mcnamarakw#mail.ports.navy.mil 
There's a gotdotnet community workspace set up for this.
I haven't tried it myself:
http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=25fe93d4-9e68-4beb-8146-ec75f8df5aa1
David

DAAB and ADO.NET

Hi,
If one uses ADO.NET is there any benefit from using DAAB? If so is there an implementation of DAAB which uses ODP.NET?
I am trying to architect a data access layer in which one may support SQL Server 2000 and Oracle. My thoughts were to use DAAB as building blocks to help provide this layer. Then I could have a consistent approach for SQL Server 2000 and for Oracle.
best wishes
Mike 
I did exactly this, so I think you're on the right track.
Here's some ideas.
First I created a abstract base class dbConnection implementing IDBConnection. Then two concrete subclasses dbConnection_SQL and dbConnection_ODP. dbConnection has a static (shared in vb) factory method to open a connection. Depending on the connection string it creates either the SQL subclass or the ODP subclass.
Each subclases provides provider specific implementations of the high-level functions in DAAB. eg
ExecuteNonQuery(commandType,SQL,IDataParameter[])
DataSet ExecuteDataSet(commandType,SQL,IDataParameter[])
(Notice how all the SQLTypes are replaced by the IDBxxx interfaces.)
as well as some more helpful methods like
FillDataTable(commandType,SQL,DataTable,IDataParameter[])
In addition the connection wrapper can do handy stuff like check that parameter markers are valid for the target database "#" or ":", remaping them if the client uses the high-level DAAB helper methods. Automatically enlisting commands in pending transactions (for SQLClient). Implementing nested transactions through savepoints, and auditing code which lets an open connection go out of scope.
David 
Dear David,
I really appreciate your advice. It really seems the way to go. I guess "great minds think alike or fools seldom differ", let hope it is the former!
Have you been able to benefit from any of the ideas from Martin Fowler's book "Patterns of Enterprise Application Architecture"?
best regards
Mike 
DAAB will, hopefully, be enhanced as help is volunteered. See DAAB Workspace - http://www.gotdotnet.com/community/messageboard/Thread.aspx?id=107438 They have a beta to support typed datasets and there is a discussion that they want to add multiple providers.
We haven't done much besides take the DAAB OracleHelper classes and substitute ODP.Net for the Microsoft Oracle Provider. ODP.Net is missing the DeriveParameters method, so for now we commented it out and don't use that feature. Hopefully ODP.Net will add DeriveParameters at some point. (MS and DataDirect support DeriveParameters)

Categories

Resources