none
Internal .Net Framework Data Provider error 30 when accessing Oracle RAC 11Gr2 RRS feed

  • Question

  • We have a .Net application that is failing on Oracle Rac 11gr2 systems only. The following code below(Sample) fails, but ONLY when choosing the Unicode=true option .

    I've checked the database Characterset on the Oracle system and it is AL32UTF8.

    Anyone run into this before?  Using .Net 4.0.30319

    using System;
    using System.Data;
    using System.Text;
    using System.Data.OracleClient;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Data.Odbc;
    using System.Data.Common;
    using System.Collections;
    using System.Threading;
    class TestCon 
    { 
       
        static void Main(string[] args) 
        { 
            try 
            { 
               
               // change the connect string for your uid/pwd/tns alias
                string constr = "user id=twval;password=twval;data source=twval1;Unicode=true;"; 
                
                OracleConnection con = new OracleConnection(constr);
              
                con.Open(); 
               
            
       
                     OracleCommand cmd2 = new OracleCommand("select value from schema_info where table_name = 'TW_VERSION'", con);
    		 IDataReader reader2 = null; 
                      reader2 = cmd2.ExecuteReader();
                       DataTable table2 = getDataTable(reader2);
                       string response = (string)table2.Rows[0]["value"].ToString();
                  
                     
     
                       Console.WriteLine("Value is {0}, hit enter",response); 
                        
                       Console.ReadLine(); 
                        reader2.Close();
    	            cmd2.Dispose();
                    
    	
                 
            } 
            catch (Exception ex) 
            { 
                Console.WriteLine("Exception occurred: {0}", ex.Message);
                Console.WriteLine("InnerException: {0}", ex.InnerException); 
                Console.ReadLine();
            } 
        }
     private static DataTable getDataTable(IDataReader reader) {
        	DataTable dt = new DataTable();
            dt.BeginLoadData();
            DataTable dtSchema = new DataTable();
            
            
            
            dtSchema = reader.GetSchemaTable();
    			for (int i = 0; i < dtSchema.Rows.Count; i++ )
    			{
    				DataRow dr = dtSchema.Rows[i];
    																	
    				string sColumnName = dr["ColumnName"].ToString().ToLower(); 
    				Type type =  (Type)dr["DataType"];					
    					
    				DataColumn col = new DataColumn(sColumnName, type);
    				dt.Columns.Add(col);
    			}
    																			
    			while (reader.Read())
    			{
    				DataRow dr = dt.NewRow();
    				for (int i = 0; i < reader.FieldCount; i++)
    				{					
    					dr[i] = reader.GetValue(i);										
    				}
    				dt.Rows.Add(dr);
    			}			
    			dt.EndLoadData();
            return dt;		
        }  
       
    } 


    Tuesday, August 27, 2013 8:48 PM

Answers

  • Hello,

    Welcome toMSDN Support Forum.

    Since I do not have an Oracle database, I run your code with SqlServer and it runs ok.

    Please see the code running in my PC below:

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace ADONET
    {
        class S2013_08_28_2
        {
            internal void Show()
            {
                try
                {
                    // change the connect string for your uid/pwd/tns alias
                    string connectionString = "server=(localdb)\\v11.0;database=TestDataBase;Integrated Security=True;";
                    SqlConnection connection = new SqlConnection(connectionString);
                    connection.Open();
                    SqlCommand command = new SqlCommand("select * from course", connection);
                    IDataReader reader = null;
                    reader = command.ExecuteReader();
                    DataTable table = getDataTable(reader);
                    string response = (string)table.Rows[0]["CourseName"].ToString();
                    Console.WriteLine("Value is {0}, hit enter", response);
                    Console.ReadLine();
                    reader.Close();
                    connection.Close();
                    connection.Dispose();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception occurred: {0}", ex.Message);
                    Console.WriteLine("InnerException: {0}", ex.InnerException);
                    Console.ReadLine();
                }
            }
            private static DataTable getDataTable(IDataReader reader)
            {
                DataTable dt = new DataTable();
                dt.BeginLoadData();
                DataTable dtSchema = new DataTable();
                dtSchema = reader.GetSchemaTable();
                for (int i = 0; i < dtSchema.Rows.Count; i++)
                {
                    DataRow dr = dtSchema.Rows[i];
                    string sColumnName = dr["ColumnName"].ToString().ToLower();
                    Type type = (Type)dr["DataType"];
                    DataColumn col = new DataColumn(sColumnName, type);
                    dt.Columns.Add(col);
                }
                while (reader.Read())
                {
                    DataRow dr = dt.NewRow();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        dr[i] = reader.GetValue(i);
                    }
                    dt.Rows.Add(dr);
                }
                dt.EndLoadData();
                return dt;
            }
        }
    }

    The Result:

    So I think it may be an oracle provider problem.

    You can post your problem to a forum about oracle like below:

    http://www.orafaq.com/forum/

    Thanks for your understanding.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 28, 2013 9:43 AM
    Moderator
  • The System.Data.OracleClient namespace has been deprecated and may be dropped from a future version of the .NET Framework. You may want to consider switching to Oracle's provider, ODP.NET.

    http://www.oracle.com/technetwork/topics/dotnet/index-085163.html


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, August 28, 2013 11:31 AM

All replies

  • Hello,

    Welcome toMSDN Support Forum.

    Since I do not have an Oracle database, I run your code with SqlServer and it runs ok.

    Please see the code running in my PC below:

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace ADONET
    {
        class S2013_08_28_2
        {
            internal void Show()
            {
                try
                {
                    // change the connect string for your uid/pwd/tns alias
                    string connectionString = "server=(localdb)\\v11.0;database=TestDataBase;Integrated Security=True;";
                    SqlConnection connection = new SqlConnection(connectionString);
                    connection.Open();
                    SqlCommand command = new SqlCommand("select * from course", connection);
                    IDataReader reader = null;
                    reader = command.ExecuteReader();
                    DataTable table = getDataTable(reader);
                    string response = (string)table.Rows[0]["CourseName"].ToString();
                    Console.WriteLine("Value is {0}, hit enter", response);
                    Console.ReadLine();
                    reader.Close();
                    connection.Close();
                    connection.Dispose();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception occurred: {0}", ex.Message);
                    Console.WriteLine("InnerException: {0}", ex.InnerException);
                    Console.ReadLine();
                }
            }
            private static DataTable getDataTable(IDataReader reader)
            {
                DataTable dt = new DataTable();
                dt.BeginLoadData();
                DataTable dtSchema = new DataTable();
                dtSchema = reader.GetSchemaTable();
                for (int i = 0; i < dtSchema.Rows.Count; i++)
                {
                    DataRow dr = dtSchema.Rows[i];
                    string sColumnName = dr["ColumnName"].ToString().ToLower();
                    Type type = (Type)dr["DataType"];
                    DataColumn col = new DataColumn(sColumnName, type);
                    dt.Columns.Add(col);
                }
                while (reader.Read())
                {
                    DataRow dr = dt.NewRow();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        dr[i] = reader.GetValue(i);
                    }
                    dt.Rows.Add(dr);
                }
                dt.EndLoadData();
                return dt;
            }
        }
    }

    The Result:

    So I think it may be an oracle provider problem.

    You can post your problem to a forum about oracle like below:

    http://www.orafaq.com/forum/

    Thanks for your understanding.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 28, 2013 9:43 AM
    Moderator
  • The System.Data.OracleClient namespace has been deprecated and may be dropped from a future version of the .NET Framework. You may want to consider switching to Oracle's provider, ODP.NET.

    http://www.oracle.com/technetwork/topics/dotnet/index-085163.html


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, August 28, 2013 11:31 AM