|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 834905 - Last Review: November 15, 2007 - Revision: 3.6 FIX: You receive an "ORA-01012" error message when you connect to an Oracle database by using MSDAORANoticeThis hotfix is available as part of a cumulative hotfix package. When you receive this hotfix from Microsoft Product Support Services, the article number that is listed in the hotfix package will be 839801 for MDAC 2.8 or 836799 for MDAC 2.7 SP1. For more information, see the following article in the Microsoft Knowledge Base:
MDAC 2.8839801Â
(http://kbalertz.com/Feedback.aspx?kbNumber=839801/
)
FIX: Hotfixes are available for MDAC 2.8
MDAC 2.7 SP1836799Â
(http://kbalertz.com/Feedback.aspx?kbNumber=836799/
)
FIX: Hotfixes are available for MDAC 2.7 Service Pack 1
You connect to an Oracle database by using the Microsoft OLE
DB Provider for Oracle (MSDAORA), and then you end the connection on the server
side. When you open a new connection to the Oracle database from your
application, you receive the following exception error message: System.Data.OleDb.OleDbException: Unspecified error
ORA-01012: not logged on When you end the connection to the Oracle database on the
server side while using MSDAORA, the broken connection is returned to the
connection pool. The connection pooling code incorrectly interacts with the ResetConnection property of MSDAORA. When this property is not supported by the
provider, the pooling code incorrectly interprets that the connection is reset,
and that the connection is a valid one. When the client code opens a new
connection, the broken connection that was returned to the connection pool may
be retrieved. Therefore, you receive the error message that is mentioned in the
"Symptoms" section. Hotfix informationA supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix. To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site: Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. File information
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel. Microsoft Data Access Components (MDAC) 2.8 Date Time Version Size File name
---------------------------------------------------------
10-Mar-2004 04:22 2.80.1036.0 225,280 Msdaora.dll
10-Mar-2004 04:22 2000.85.1036.0 24,576 Odbcbcp.dll
10-Mar-2004 04:21 2.80.1036.0 442,368 Oledb32.dll
10-Mar-2004 04:21 2000.85.1036.0 401,408 Sqlsrv32.dll MDAC 2.7 Service Pack 1 Date Time Version Size File name
---------------------------------------------------------
10-Mar-2004 02:19 2000.81.9046.0 61,440 Dbnetlib.dll
10-Mar-2004 02:20 2.71.9046.0 221,184 Msdaora.dll
10-Mar-2004 02:15 2.71.9046.0 126,976 Msdart.dll
10-Mar-2004 02:15 3.520.9046.0 204,800 Odbc32.dll
10-Mar-2004 02:20 2000.81.9046.0 24,576 Odbcbcp.dll
10-Mar-2004 02:20 3.520.9046.0 98,304 Odbccp32.dll
10-Mar-2004 02:16 2.71.9046.0 417,792 Oledb32.dll
10-Mar-2004 02:19 2000.81.9046.0 471,040 Sqloledb.dll
10-Mar-2004 02:19 2000.81.9046.0 385,024 Sqlsrv32.dll Microsoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section. Steps to reproduce the behavior- Start Microsoft Visual Studio .NET.
- On the File menu, point to
New, and then click Project. The New
Project dialog box appears.
- Under Project Types, click Visual
Basic Projects, and then click Console Application
under Templates.
- In the Name box, type
MyApp, and then click OK. By default,
the Module1.vb file is created.
If you are using Microsoft Visual C#
.NET, the Class1.cs file is created. - Add the following code at the top:
Microsoft Visual Basic .NET codeImports System
Imports System.Data.OleDb Visual C# .NET code - Add the following code to the Main
procedure:
Visual Basic .NET codeDim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim r As OleDbDataReader
Dim sid As String
Dim orlcmd As String
Dim connString As String = "Provider=MSDAORA;DataSource=<data source>;User ID=<user name>;Password=<password>;"
Try
'Create a new connection to the Oracle database by using MSDAORA.
cn = New OleDbConnection
cn.ConnectionString = connString
cn.Open()
cmd = New OleDbCommand
cmd.CommandText = "SELECT SID , SERIAL# FROM V$SESSION WHERE SID = (SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)"
cmd.Connection = cn
r = cmd.ExecuteReader()
sid = ""
If (r.Read()) Then
sid = r.GetValue(0).ToString() + "," + r.GetValue(1).ToString()
End If
orlcmd = "Alter System Kill Session '" + sid + "' Immediate;"
Console.WriteLine("Open the SQL Plus window, run the following command, and then press ENTER:")
Console.WriteLine(orlcmd)
Console.ReadLine()
r.Close()
cmd.CommandText = "SELECT count(*) from TAB"
Try
'Expecting this command to fail because connection has been killed
r = cmd.ExecuteReader()
Catch orlex As OleDbException
Console.WriteLine(orlex.Message)
cmd.Dispose()
'Close the bad connection.
cn.Close()
System.Threading.Thread.Sleep(1000)
cn.ConnectionString = connString
cn.Open()
cmd = New OleDbCommand
cmd.CommandText = "SELECT count(*) FROM TAB"
cmd.Connection = cn
'This command will fail, but it will work when a new connection is used.
r = cmd.ExecuteReader()
If (r.Read()) Then
Console.WriteLine(r.GetValue(0))
End If
End Try
Catch ex As OleDbException
Console.WriteLine(ex.ToString())
End Try
Console.WriteLine("Press ENTER to exit...")
Console.ReadLine()
Visual C# .NET codeOleDbConnection cn;
OleDbCommand cmd;
OleDbDataReader r;
String sid;
String orlcmd;
String connString="Provider=MSDAORA;DataSource=<data source>;User ID=<user name>;Password=<password>;";
try
{
//Create a connection to the Oracle database by using MSDAORA.
cn= new OleDbConnection();
cn.ConnectionString=connString;
cn.Open();
cmd=new OleDbCommand();
cmd.CommandText="SELECT SID , SERIAL# FROM V$SESSION WHERE SID = (SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)";
cmd.Connection=cn;
r=cmd.ExecuteReader();
sid="";
if(r.Read())
{
sid=r.GetValue(0).ToString()+","+r.GetValue(1).ToString();
}
orlcmd="Alter System Kill Session '"+sid+"' Immediate;";
Console.WriteLine("Open the SQL Plus window, run the following command, and then press ENTER:");
Console.WriteLine(orlcmd);
Console.ReadLine();
r.Close();
cmd.CommandText="SELECT count(*) from TAB";
try
{
//Expecting this to fail because the connection is killed.
r=cmd.ExecuteReader();
}
catch(OleDbException orlex)
{
Console.WriteLine(orlex.Message);
cmd.Dispose();
//Close the bad connection.
cn.Close();
System.Threading.Thread.Sleep(1000);
cn.ConnectionString=connString;
cn.Open();
cmd=new OleDbCommand();
cmd.CommandText="SELECT count(*) FROM TAB";
cmd.Connection=cn;
//This command will fail, but it will work when a new connection is used.
r=cmd.ExecuteReader();
if(r.Read())
{
Console.WriteLine(r.GetValue(0).ToString());
}
}
}
catch(OleDbException ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Press ENTER to exit...");
Console.ReadLine();
Note Modify the connection string according to your
environment. - On the Build menu, click Build
Solution.
- On the Debug menu, click
Start. You see that a command is displayed in the console
window.
- In Oracle SQL*Plus, run the command that is displayed in
the console window.
- Press ENTER. In the console window, you see the exception
that is mentioned in the "Symptoms" section.
For more information about the Microsoft OLE DB Provider for
Oracle, visit the following Microsoft Developer Network (MSDN) Web site: For
additional information, click the following article number to view the article
in the Microsoft Knowledge Base: 824684Â
(http://kbalertz.com/Feedback.aspx?kbNumber=824684/
)
Description of the standard terminology that is used to describe Microsoft software updates
The third-party products that this
article discusses are manufactured by companies that are independent of
Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the
performance or reliability of these products.
APPLIES TO- Microsoft Data Access Components 2.8
- Microsoft Data Access Components 2.7 Service Pack 1
| kbhotfixserver kbqfe kbbug kbprovider kbconnectivity kbdatabase kboracle kbfix kbqfe KB834905 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
|
 |
 |
 |
 |
 |
 |
 |
| |