| |
Welcome to the dBforums forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact support.
If you prefer not to see double-underlined words and corresponding ads, place your cursor here for ContentLink opt out.
|
 |

01-15-08, 07:38
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 5
|
|
|
ADO Catastrophic error when opening connection as Windows service on Oracle 10
|
Dear all,
I am maintaining a Windows application that can run both from command line and as a Windows service. The application connects to an Oracle DB upon startup.
When launching the application on an Oracle 9.2 or 8.1.7 client, everything goes well, both from command line and as a Windows service. When launching it from command line on Oracle 10, everything goes well.
When launching it as a Windows service from a machine with Oracle 10 installed, I receive the following error when trying to open the connection:
Error -2147418113: Catastrophic failure
Executing the service as myself, instead of Local System, or allowing the service to interact with desktop, makes no difference.
This code snippet illustrates the problem:
Code:
ofstream out("path-to-my-log-file.txt", ios_base::app);
const char *s = "..."; // a valid connection string
try
{
if(FAILED(::CoInitialize(NULL)))
return;
_ConnectionPtr _connection;
_connection.CreateInstance(__uuidof(Connection));
out << "Opening " << s << endl;
_connection->Open (s, "", "", adConnectUnspecified);
// Windows service on Oracle 10 fails on Open()
out << "Closing connection" << endl;
_connection->Close();
out << "Done" << endl;
}
catch (_com_error &e)
{
out << "Error " << e.Error() << ": " << e.ErrorMessage() << endl;
}
Some more details: - I am running Windows XP Professional, Service Pack 2
- I have Oracle 10g XE Server (10.2.0) installed on my machine, but I could reproduce the problem on a machine with the client components only
The attached .zip file contains the sources for a more complete example.
Thanks in advance for your help!
|
|

01-15-08, 09:58
|
|
Lost Boy
|
|
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 2,717
|
|
Whoa! I'm sorry for wasting your time (as I'm unable to help you), but - seeing a title about the "catastrophic error", my first thought was that this man is certainly exaggerating. But no, it is a true catastrophe! Amazing!
|
|

01-15-08, 10:10
|
|
Registered User
|
|
Join Date: Jun 2004
Location: Liverpool, NY USA
Posts: 1,642
|
|
|
__________________
Bill
Cream always raises to the top, and so does the scum!!
|
|

01-16-08, 01:52
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 5
|
|
Quote:
|
Originally Posted by beilstwh
|
Thanks, but the KB article is about a different problem ("operation following a rollback or a commit transaction on a recordset opened as a serverside cursor").
My problem is that I don't even manage to open the connection.
|
|

01-16-08, 02:18
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 3,566
|
|
>When launching the application on an Oracle 9.2 or 8.1.7 client, everything goes well, both from command line and as a Windows service. When launching it from command line on Oracle 10, everything goes well.
>When launching it as a Windows service from a machine with Oracle 10 installed, I receive the following error when trying to open the connection:
>Error -2147418113: Catastrophic failure
So explain again why this is an Oracle problem & NOT a Windoze failure;
because it looks to me like a pure Windoze problem.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
|
|

01-16-08, 03:29
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 5
|
|
Quote:
|
Originally Posted by anacedent
So explain again why this is an Oracle problem & NOT a Windoze failure;
because it looks to me like a pure Windoze problem.
|
Because, with the same OS version, my test program works on Oracle 9 client and it fails on Oracle 10 client.
Because if I create a Microsoft Access file, say "C:\test.mdb", and I run my test program with this connect string "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb", it works both from command line and as a Windows service.
Either of these points makes me think this is an Oracle problem (at least in part  ; mind you, I'm not saying that Windows is blameless...)
Meanwhile, some more failed attempts to solve the issue: using specific versions of ADO ( msado20.tlb through msado27.tlb) instead of msado15.dll makes absolutely no difference.
|
|

01-16-08, 10:30
|
|
Registered User
|
|
Join Date: Jun 2004
Location: Liverpool, NY USA
Posts: 1,642
|
|
Read the article. There solution was to UPGRADE the ODBC client, the version for Oracle 9 does not support all the calls and data types from Oracle 10.
__________________
Bill
Cream always raises to the top, and so does the scum!!
|
|

01-17-08, 03:34
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 5
|
|
Quote:
|
Originally Posted by beilstwh
Read the article. There solution was to UPGRADE the ODBC client, the version for Oracle 9 does not support all the calls and data types from Oracle 10.
|
Bill, thanks for the suggestion.
I did read the article ( http://support.microsoft.com/default.aspx/kb/187942) which does not mention upgrading ODBC - their solution was to "use adUseClient". Possibly you meant a different article?
Anyway, I downloaded the most recent versions of MDAC from the Microsoft site. Installing "MDAC 2.7 Service Pack 1 Refresh" did not have any effect, while MDAC 2.8 would not install ("MDAC 2.8 RTM is incompatible with this version of Windows. All of its features are currently part of Windows").
By the way, a preliminary test using the ODBC API instead of ADO seems to be working fine also when running as a service and using Oracle 10. Unfortunately, porting the full application to ODBC would not be as easy (nor as safe) as porting the test program.
|
Last edited by paolog : 01-17-08 at 13:05.
|

05-14-08, 04:39
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 5
|
|
|
ADO Catastrophic error when opening connection as Windows service, Oracle 10 [SOLVED]
Finally the problem is solved. It seems that, when you use it from a Windows service, the Oracle 10 driver does not initialize correctly the first time, regardless of the API (ADO or ODBC), but if you ignore the error and try again, everything works fine.
So I solved the problem like this:
Code:
// The following is a workaround for a bug in the Oracle 10 client,
// only affecting the application when it runs as a system service.
// Dut to this bug, the first attempt to open a connection fails
// ("catastrophic failure") but subsequent attempts (on separate
// Connection objects) work correctly.
try {
_ConnectionPtr workaround;
TESTHR(workaround.CreateInstance(__uuidof(Connection)));
workaround->Open(myConnectString, "", "", adConnectUnspecified);
workaround->Close();
}
catch (...)
{
;
}
TESTHR(myConnection.CreateInstance(__uuidof(Connection)));
myConnection->Open(myConnectString, "", "", adConnectUnspecified);
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|