|
Thank you much for your suggestions!
I was not much specific about implementation detail just because they are quite fuzzy, ATM.
I'm sketching the system architecture designing boxes to be filled with selected components.
So the question is "what is the best technology for implementing this component"? I can't start working if I don't have a picture of the desired result.
I.E.
For the data provider on the client side, for maximum compatibility, the choice is still VC++, COM and OLE DB (either with ATL or not). This manages the communication with the client-side only, so I needed some hint on what's the best technology (for scalability, flexibility, ease of use, performance, ...) to implement the network communication layer.
DCOM, for instance, is harder to implement and does not get easily through firewalls (for what I read, I didn't use it really).
I read about .NET remoting: it's easy to use and performs quite good, but it's managed and seems difficult to integrate with native OLE DB code.
Asynchronous WinHTTP seems really promising: thanks for pointing that out!
If you have any other suggestion, it's really appreciated.
|
|
|
|
|
I had to read up on OLE DB, as I'm unfamilar with its object hierarchy. And, I really don't know what to suggest, except that you do some serious research on the underlying RPC transport that COM uses when accessing remote objects, for instance: (The RPC Model Overview, MSDN[^]). This occurs in a largely transparent way (from a programmer's point of view). So, you don't really create a network layer, specifically. Typically, with standard marshaling, MIDL is used to generate COM interface definitions for your DB provider and comsumer components, and the Proxy/Stub architecture that COM relies on for instantiating remote objects. The security model is implemented at the network machine level boundary (think, AccessCheck) through authentication and Operating System mechanisms of access control which can be configured either programatically or administratively. If you can get a copy of Don Box's 'Essential COM' or, 'Inside COM+ Base Services', by Guy Eddon, I would suggest that you familarize your self with the security aspects of COM. There are a number of technical articles at MSDN, for instance:
COM, Component Object Technologies, MSDN[^], and, COM Security in Practice, MSDN[^], or, DCOM Architecture, MSDN[^].
The .NET Framework is largely designed to make internet access easy, but, this depends largely on which version of the runtime you use. Interop between COM and the .NET Framework is also a possibility, but, many programmers initially find this approach cumbersome and error prone. Also, the NET redistributables and whatever dependent libraries are necessary, must be installed on both server and client.
I think your answer, is to do more research,...but, start with COM, since the OLE DB component is COM (this will initially simplify alot of development).
|
|
|
|
|
I've just encountered a bit of an issue while trying to do some sort of automatic recovery from a MySQL server crash to a C++ app.
Basicly, once I catch a DB_E_ABORTLIMITREACHED somewhere in the app I set an event to perform a ->Close() and ->Open() (in a separate thread) and check if that worked OK. I keep doing this for each throw with the above error.
Problem comes up when the Open() is theoretically ok again, all other apps that rely on that server are properly working with it again but any attempt at calling ->Execute() keeps throwing the same thing.
Has anyone encountered this behaviour before and could shed some light on why and maybe how to fix?
PS: After about 5 minutes of throwing that exception (after I restart MySQL that is) stuff miraculously starts working again, no more exceptions.
PS2: Also tried clearing Errors, there aren't any there it seems.
Here's a bit of code that might make things more clear:
_ConnectionPtr pConn;
try
{
pConn->Execute(...);
}
catch (_com_error &e)
{
switch (e.Error())
{
case DB_E_ABORTLIMITREACHED:
SetEvent(hReconnectDBEvent);
break;
}
...
}
while (keepChecking)
{
waitRes = WaitForMultipleObjects(..., 30000);
switch (waitRes)
{
case WAIT_OBJECT_the_reconnect_event:
if (pConn->State == adStateOpen)
{
pConn->Close();
}
pConn->Open(...);
break;
}
}
Once connection is reopened ok attempts to Execute something still throw that exception for about 5 more minutes. After that everything returns back to normal.
Last modified: 1hr 5mins after originally posted -- clarification, code
|
|
|
|
|
Is there any reason you suspect that this might be COM related and not MySQL related? As per the great MSDN, DB_E_ABORTLIMITREACHED means this - "Execution aborted because a resource limit has been reached; no results have been returned.". I am just guessing, but maybe you're hitting maximum concurrent connection limits (the fact that a restart of MySQL fixes the issue also supports this theory)? Are you using smart pointers for your ADO connection objects?
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
That isn't thrown randomly and MySQL restart doesn't fix it. If I stop MySQL (or for some weird reason the application is cut off from the SQL server) then this is thrown, with a message of "Connection to MySQL died" or something like that.
After that I start MySQL back up my thought was that a reopening should allow me to work again but even if Open() works just fine (I manually force the exception after SQL is back up which leads to Open()), attempting Execute() throws the same exception as before, for about 5 minutes after which it magically works.
And there is the possibility that MySQL might be the one doing this due to some weird timeout. And I only have 1 connection to MySQL which is supposed to be open all the time (communication is supposed to work even over a 9600bps line, opening connections every query can add quite a bit of ovehead when the same line is also used for App -> App Server comm).
|
|
|
|
|
Sounds like the OLE DB driver is doing some kind of connection optimization by physically attempting an "open" only when a query is executed - a "lazy connect" if you will. One area you might want to look into is connection pooling. See if turning off connection pooling produces different results. MSDN has more[^] on this.
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
Hi developers,
How to transfer serial port settings in one form design to another form.I used that serialport method error occured access denied COM1 and how solve this problem
|
|
|
|
|
Are we talking about COM as in COM1, COM2 etc or COM as in Component Object Model, or both?
|
|
|
|
|
Hi,
I would like to add some text in the cation of document. e.g. If I have a Test.doc then the caption for this document is Test.doc but I want to add some more text to it like "Mydoc" so the caption will become "Test.doc Mydoc". I know we need to change some registery entries but I want to change it for all office documents. Actually I m changing the extension of these documents as Test.gdoc so for all office docs with extension it should attach this caption.
Pls let me know that how could we achieve this.
Thanks
SNI
SNI
|
|
|
|
|
What if you handle the "Open" event for the Document object in "Normal.dot" and write code that looks like this?
Private Sub Document_Open()
If IsFileGDOC(ActiveDocument.name) Then
ActiveDocument.Windows(1).Caption = ActiveDocument.Windows(1).Caption & " - Ding"
End If
End Sub
Private Function IsFileGDOC(name As String) As Boolean
IsFileGDOC = False
If InStr(1, name, ".gdoc", vbTextCompare) Then
IsFileGDOC = True
End If
End Function To edit "Normal.dot" just open the VBA editor in Word and edit the code for the "ThisDocument" object in "Project Explorer" under the "Normal" document.
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
I am using the VC 6.0 ocx in VB6.0
In this ocx I am firing the event in thread with long value as parameter.
There is only single thread.
I am getting the correct value in client(vb) application.
It's working fine when I am running it.
But when I tried to debug in VB application in event after pressing F8
application suddenly exits. But without threading it's I can debug also.
I could not get the problem. When I used try catch around fire event it gives exception as memory could not read.
Help me for this....
Thanks in advance.
|
|
|
|
|
chetanjoshi9 wrote: In this ocx I am firing the event in thread with long value as parameter.
There is only single thread.
....
But without threading it's I can debug also.
What does this mean? Are you creating secondary threads inside your ActiveX or not?
If you are firing events from a secondary thread, you have to initialize the new apartment with a call to ::CoInitialize() and marshal the event sink interface to the client from the apartment that created your server to the apartment with your secondary thread.
Another solution is to post a message to the thread that created your server and fire the event from there.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello,
I have created a C# DLL with two functions:
One function has two parameters: double, double
The other function has four paramters: double[], double[], double[], double[]
Using VB6, I can successfully call the first function. However, upon trying to call the second function, I get a compile-time error:
Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.
I need to pass arrays of doubles. How can I get the program to work? Any help is appreciated.
Regards,
Mike
|
|
|
|
|
The solution to get the VB6 program to compile is to use:
ref double[], ref double[], ref double[], ref double[]
for the parameters.
Regards,
Mike
|
|
|
|
|
Hi
I am working on DRM (Digital right management) and WMP (Window media player).
I added assembly Interop.WMRMOBJSLib.dll
While the code is executing this line then it throw the error
i.e.
Retrieving the COM class factory for component with CLSID {76FB40C2-7B90-402A-867D-73747BF85F48} failed due to the following error: 80040154.
Here I am mentioned the code.
-----------------------------------------------------------------------
WMRMOBJSLib.IWMRMChallenge objChallenge = new WMRMOBJSLib.WMRMChallengeClass(); //Instantiate challenge Object
objChallenge.Challenge = Request.Params["challenge"];
string varClientInfo = objChallenge.ClientInfo; //to retrive client information
string varHeader = objChallenge.Header; //to retrive the header information of the content
WMRMOBJSLib.IWMRMHeader objHeader = new WMRMOBJSLib.WMRMHeaderClass(); //to instantiate header object
objHeader.Header = varHeader;
string strContentID=objHeader.ContentID; //retrives the contentid of the file played
string indiVersion = objHeader.IndividualizedVersion;
//Report an error if ContentID not found in DRM headers
if(strContentID == null)
{
ReportError("Content not found.");
return;
}
//Get action currently performed
string action = Request.Params["action"];
-----------------------------------------------------------------------
In few article I read Class not registered.
I checked into regedit.
Here I mentioned used .dll
• Interop.LICENSESERVERLib.dll
• Interop.WMRMOBJSLib.dll
• MySql.Data.dll
So kindly suggest me, where is problem.
Its very urget.
Kindly reply me.
Thanks
Asit Sinha
Asit Sinha
|
|
|
|
|
Hi all,
Not sure if this is the right place to post but any help would be greatly appreciated
I've used the code from http://www.codeproject.com/KB/cs/adapterlist.aspx to enumerate adapter bindings. I need to change the network adapter binding order for laptops which have the Wireless connection set as the default (the LAN connection needs to go first). We have over 4000 laptops in our organisation, so setting the adapter order manually would be slightly difficult
In order to change the adapters binding order I need to use the interface InetCG to aquire a writelock.
object objINetCfg = null;
int nRet = 0;
nRet = Ole32Methods.CoCreateInstance(ref INetCfg_Guid.CLSID_CNetCfg, null, Ole32Methods.CLSCTX_INPROC_SERVER, ref INetCfg_Guid.IID_INetCfg, out objINetCfg);
INetCfg netCfg = objINetCfg as INetCfg;
string s;
INetCfgLock netCfgLock = netCfg as INetCfgLock;
int ret = netCfgLock.AcquireWriteLock(5000, "CLIENT", out s);
When trying using the method AcquireWriteLock I get a NullReference exception. I'm using Win XP SP3. Does anyone know what might be going wrong?
Thanks
Paul
|
|
|
|
|
|
Hi,
I am getting base64 text and i want to generate a png image from it. Can anyone please suggest me a good encoder or decode for the same. If anyone knows how to go about with yhis then plz help. The coding for the application is done using VB(using COM) and ASP. So any encoder or decoder making use of VB will be more useful. Plz provide me the details of the links if any.
Regards,
Shiney
Shiney
Shiney
|
|
|
|
|
Decoding base64 has nothing to do with COM.
Read 4 bytes, extract 6 left bits from each of the 4 bytes (24 bits) and create 3 bytes by concatenating the bits.
«_Superman_»
|
|
|
|
|
Hi,
I created an activeX control by using the details from the link
http://www.codeproject.com/KB/vb-interop/VB6InteropToolkit2.aspx?fid=422404&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2441751[^]
I am able to create the activeX control using datagridView and I even added it to VB 6.0 components (Ctrl+T) , but the problem is I am not able to access the properties of the datagrid added instead I am only able to see the basic propertis.And this ActiveX comes with the container kind of thing.
Please help me on it so that i vl be able to access the datagrid properties from VB 6.0 and be able to handle the ActiveX component created in C# as any general third party control.
Guid me if I am following any wrong process.
please reply ASAP.
Thanks in advance
Vani
|
|
|
|
|
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)?
thx
|
|
|
|
|
As far as I know you can't. COM is all about creating object then calling functions those object provide (via interfaces). You could call a VB Shared method and within that method create a new COM object, call its function then delete it - all within the Shared VB. On the other hand perhaps using a Shared may not be the only way to do what you want.
|
|
|
|
|
Shared vb function than creates an instance of my class, calls function (static one) then delete that object is a good solution, but not a perfect one. Was thinking perhaps there is a keyword that will expose function the way I want
If you can tell me what's the other way arround please let me know
thx
|
|
|
|
|
Sorry, I haven't got another way exactly. What I meant was that when using VB you tend to get used to the things VB lets you do and use - such as using Shared. With COM you have to think more in terms of objects and interfaces and so you tend to design solutions around them.
|
|
|
|
|
Static functions from c++ are equivalent to shared from VB; was thinking there is a way to just expose this static functions; if there isn't will just have to call code in vb common way, using object
thx
|
|
|
|
|