ODBC Q
-
I am sorry if this seems off topic here, but I'm not sure where else I could post this question, and the people lurking in this forum probably know something of DBs, and may know something that can help me, so... ...not to mention this problem is **killing** me ! Here goes: I'm trying to set a dll to trace the ODBC communications. The machine is running Win 2K 5.00 w/ SP-4. I downloaded and installed the MDAC 2.8 and MDAC SDK 2.6. From the MDAC SDK I got the source code for the trace.dll. So I compiled it in Visual Studio 6.0, and I obtained the trace.dll. Now, in the Administrative Tools>Data Sources, in the Tracing tab, I click on "Select DLL", navigate to the location of the trace.dll, and click "OK. When I click "OK" or "Apply", I receive the error message: "General Error: either C:\WINNT\system32\trace.dll is not an ODBC tracing dll or it is obsolete." with an "OK" button. Well... I'm not Ok with it, but I can only click on it... After Ok-ing the error message, the DLL in the "Custom Trace DLL" text box (in the Data Source > Tracing tab) reverts to "C:\WINNT\system32\odbctrac.dll", which was the value in it before I tried to change it. I looked at the dependencies of the two dlls involved, to check if I was not exporting something. I noticed that the trace.dll was not listing all of its routines. So I added a trace.def file to my project, listed all of the routines to be exported (I think), and tried again. Now the trace.dll shows the various routines when I "View Dependencies" on it, but the rest of the scenario has not changed. Last attempt (after long research on the net) was to modify the signature of the routines to be exported so that they are preceeded by __declspec(dllexport) to ensure that they are being exported, but nothing changed... ....Suggestions? Thanks in advance for your attention, Frank
-
I am sorry if this seems off topic here, but I'm not sure where else I could post this question, and the people lurking in this forum probably know something of DBs, and may know something that can help me, so... ...not to mention this problem is **killing** me ! Here goes: I'm trying to set a dll to trace the ODBC communications. The machine is running Win 2K 5.00 w/ SP-4. I downloaded and installed the MDAC 2.8 and MDAC SDK 2.6. From the MDAC SDK I got the source code for the trace.dll. So I compiled it in Visual Studio 6.0, and I obtained the trace.dll. Now, in the Administrative Tools>Data Sources, in the Tracing tab, I click on "Select DLL", navigate to the location of the trace.dll, and click "OK. When I click "OK" or "Apply", I receive the error message: "General Error: either C:\WINNT\system32\trace.dll is not an ODBC tracing dll or it is obsolete." with an "OK" button. Well... I'm not Ok with it, but I can only click on it... After Ok-ing the error message, the DLL in the "Custom Trace DLL" text box (in the Data Source > Tracing tab) reverts to "C:\WINNT\system32\odbctrac.dll", which was the value in it before I tried to change it. I looked at the dependencies of the two dlls involved, to check if I was not exporting something. I noticed that the trace.dll was not listing all of its routines. So I added a trace.def file to my project, listed all of the routines to be exported (I think), and tried again. Now the trace.dll shows the various routines when I "View Dependencies" on it, but the rest of the scenario has not changed. Last attempt (after long research on the net) was to modify the signature of the routines to be exported so that they are preceeded by __declspec(dllexport) to ensure that they are being exported, but nothing changed... ....Suggestions? Thanks in advance for your attention, Frank
[mode="supplicant"] ..please ? [/mode] F.O.R.
-
[mode="supplicant"] ..please ? [/mode] F.O.R.
A couple of things spring to mind: Are the functions declared
extern "C"
if compiled as C++? Is theTraceVersion
function returning the correct version number? -
A couple of things spring to mind: Are the functions declared
extern "C"
if compiled as C++? Is theTraceVersion
function returning the correct version number?Mike Dimmick wrote: A couple of things spring to mind: Are the functions declared extern "C" if compiled as C++? Is the TraceVersion function returning the correct version number? Mike, first of all thanks for replying. The source code is the done that comes with the MDAC SDK. The various functions are declared as: RETCODE SQL_API TraceSQLxxx SQL_API is defined as __stdcall. The sqltypes.h header file imported in the project includes the following block: #ifdef __cplusplus extern "C" { /* Assume C declarations for C++ */ #endif /* __cplusplus */ How would I check the results of TraceVersion? Do I need to build my harness to call just that routine and get the result? BTW, which one would be the correct version? Looking at the code, the TraceVersion routine returns the TRACE_VERSION constant, defined in SQLEXT.H as 1000. Thanks in advance, F.O.R.
-
Mike Dimmick wrote: A couple of things spring to mind: Are the functions declared extern "C" if compiled as C++? Is the TraceVersion function returning the correct version number? Mike, first of all thanks for replying. The source code is the done that comes with the MDAC SDK. The various functions are declared as: RETCODE SQL_API TraceSQLxxx SQL_API is defined as __stdcall. The sqltypes.h header file imported in the project includes the following block: #ifdef __cplusplus extern "C" { /* Assume C declarations for C++ */ #endif /* __cplusplus */ How would I check the results of TraceVersion? Do I need to build my harness to call just that routine and get the result? BTW, which one would be the correct version? Looking at the code, the TraceVersion routine returns the TRACE_VERSION constant, defined in SQLEXT.H as 1000. Thanks in advance, F.O.R.
Well, it's neither of my extremely obvious points, so it looks like you're on your own again. Sorry. I don't have any experience in writing trace DLLs.
-
Well, it's neither of my extremely obvious points, so it looks like you're on your own again. Sorry. I don't have any experience in writing trace DLLs.
Thanks anyway... ..the funny thing is, it seems *nobody* has experience with this. I mean, some of the DB-gurus I talked to didn't even know you could specify your own trace DLL, and after much googling, I haven't found any info.. I guess I'm (once again) on the bleeding edge of technology that has been around for 5+ years but was always overlooked :-) Thanks, F.O.R.
-
Thanks anyway... ..the funny thing is, it seems *nobody* has experience with this. I mean, some of the DB-gurus I talked to didn't even know you could specify your own trace DLL, and after much googling, I haven't found any info.. I guess I'm (once again) on the bleeding edge of technology that has been around for 5+ years but was always overlooked :-) Thanks, F.O.R.
Frank Olorin Rizzi wrote: I mean, some of the DB-gurus I talked to didn't even know you could specify your own trace DLL Count me in on the group. I thought I had done literally every advanced thing you can do with ODBC, but that's one thing I haven't done. When you do find out how to do this, there might be an article in there.... Cheers, Tom Archer Inside C#,
Extending MFC Applications with the .NET Framework It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson -
Frank Olorin Rizzi wrote: I mean, some of the DB-gurus I talked to didn't even know you could specify your own trace DLL Count me in on the group. I thought I had done literally every advanced thing you can do with ODBC, but that's one thing I haven't done. When you do find out how to do this, there might be an article in there.... Cheers, Tom Archer Inside C#,
Extending MFC Applications with the .NET Framework It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen SigvardssonTom Archer wrote: When you do find out how to do this, there might be an article in there.... "If"..."If I find out" :-) I'll be sure to post any solution I find :-) F.O.R.
-
I am sorry if this seems off topic here, but I'm not sure where else I could post this question, and the people lurking in this forum probably know something of DBs, and may know something that can help me, so... ...not to mention this problem is **killing** me ! Here goes: I'm trying to set a dll to trace the ODBC communications. The machine is running Win 2K 5.00 w/ SP-4. I downloaded and installed the MDAC 2.8 and MDAC SDK 2.6. From the MDAC SDK I got the source code for the trace.dll. So I compiled it in Visual Studio 6.0, and I obtained the trace.dll. Now, in the Administrative Tools>Data Sources, in the Tracing tab, I click on "Select DLL", navigate to the location of the trace.dll, and click "OK. When I click "OK" or "Apply", I receive the error message: "General Error: either C:\WINNT\system32\trace.dll is not an ODBC tracing dll or it is obsolete." with an "OK" button. Well... I'm not Ok with it, but I can only click on it... After Ok-ing the error message, the DLL in the "Custom Trace DLL" text box (in the Data Source > Tracing tab) reverts to "C:\WINNT\system32\odbctrac.dll", which was the value in it before I tried to change it. I looked at the dependencies of the two dlls involved, to check if I was not exporting something. I noticed that the trace.dll was not listing all of its routines. So I added a trace.def file to my project, listed all of the routines to be exported (I think), and tried again. Now the trace.dll shows the various routines when I "View Dependencies" on it, but the rest of the scenario has not changed. Last attempt (after long research on the net) was to modify the signature of the routines to be exported so that they are preceeded by __declspec(dllexport) to ensure that they are being exported, but nothing changed... ....Suggestions? Thanks in advance for your attention, Frank
Here's the latest update I can provide: After checking the list of routines exported by the odbctrac.dll (the one that works), and the list of routines exported by the trace.dll (the one produced by compiling the source code provided by M$ in the samples for ODBC from the MDAC SDK), I found that two routines where missing from the trace.dll: FireVSDebugEvent TraceVSControl So, I added to the .def file for trace.dll. Compiling, I got an external unreesolved error for FireVSDebugEvent (indeed, the other one is implemented in one of the files in the project). The signature for FireVSDebugEvent is provided, but no implementation. So I made a dummy implementation (FireVSDebugEvent returns void, so I just did nothing in its body), and tried again. It *still* doesn't work. So, my conclusion, at this time, is that there has been some change to the requirements for the ODBC trace DLL since the 2.6 version (I got the source code from MDAC SDK 2.6, but the MDAC itself is up to 2.8). Apparently, M$ will release the ComponentChecker for MDAC 2.8 ASAP. I am hoping that, at that time, they will release a new MDAC SDK, or provide a list of changes. For the time being, I'll put this aside. Hope this can provide some info to those interested, even if it is not a solution. F.O.R.
-
Here's the latest update I can provide: After checking the list of routines exported by the odbctrac.dll (the one that works), and the list of routines exported by the trace.dll (the one produced by compiling the source code provided by M$ in the samples for ODBC from the MDAC SDK), I found that two routines where missing from the trace.dll: FireVSDebugEvent TraceVSControl So, I added to the .def file for trace.dll. Compiling, I got an external unreesolved error for FireVSDebugEvent (indeed, the other one is implemented in one of the files in the project). The signature for FireVSDebugEvent is provided, but no implementation. So I made a dummy implementation (FireVSDebugEvent returns void, so I just did nothing in its body), and tried again. It *still* doesn't work. So, my conclusion, at this time, is that there has been some change to the requirements for the ODBC trace DLL since the 2.6 version (I got the source code from MDAC SDK 2.6, but the MDAC itself is up to 2.8). Apparently, M$ will release the ComponentChecker for MDAC 2.8 ASAP. I am hoping that, at that time, they will release a new MDAC SDK, or provide a list of changes. For the time being, I'll put this aside. Hope this can provide some info to those interested, even if it is not a solution. F.O.R.
For anyone who may stumble upon this... A colleague of mine actually fixed this to work. Apparently, he simply added the .def file to export all of the various TraceSQL* routines. In addition to that, he had to include the FireVSDebugEvent and TraceVSControl routines to the .def file. Looking at his source, and mine, I guess mine wasn't working because I had __declspec(_stdcall) (or something like that...I'm not 100% sure yet). In short: the source code from MS seems to work once you add the .def file. Hope this Helps, F.O.R. PS: Props to my colleague, and to Brannon, who sent some helpful hints as well!