Search found 5 matches

by bernhard.klefer
Wed 08 Dec 2010 19:49
Forum: dotConnect for Oracle
Topic: dotConnect getting confused between multiple oracle homes
Replies: 19
Views: 7618

I' having the same problem with dotConnect 6.0.58.

After assigning a home to a OracleConnection instance all other instances will use that same home, even if you assign a differen home to them.

for example:

Code: Select all

using (OracleConnection db1Conn = new OracleConnection {Home = "OraClient11g_home1", Server = db1, UserId = "xxxx", Password = "xxxx"}) { 
   try { db1Conn.Open();}
   catch { //This will fail because db1 is not available for home1 }
} 

using (OracleConnection db2Conn = new OracleConnection {Home = "OraClient11g_home2", Server = db1, UserId = "xxxx", Password = "xxxx"}) { 
   try {db2Conn.Open();}
   catch { //This should work but does also fail }
}
but if you try just the second home it will succeed.

Code: Select all

using (OracleConnection db2Conn = new OracleConnection {Home = "OraClient11g_home2", Server = db1, UserId = "xxxx", Password = "xxxx"}) { 
   try {db2Conn.Open();} //This works
   catch { }
}
by bernhard.klefer
Wed 08 Dec 2010 11:47
Forum: dotConnect for Oracle
Topic: Find the right Oracle Client for both x86 and x64.
Replies: 5
Views: 2490

I've just found a that if you assign a Oracle home name to the OracleConnection.Home property, the connection will choose the right version, even if a home with the same name exists in both x86 and x64.

So its something like this:

Code: Select all

var oracleKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("ORACLE");
string home = (string)oracleKey.OpenSubKey(oracleKey.GetSubKeyNames()[0]).GetValue("ORACLE_HOME_NAME");

connection.Home=home;
connection.Open();
This is a useful workaround for the time being.

Bernhard.
by bernhard.klefer
Tue 07 Dec 2010 23:41
Forum: dotConnect for Oracle
Topic: Severe problems with dotConnect and Oracle 9i Server
Replies: 3
Views: 2450

Severe problems with dotConnect and Oracle 9i Server

Hi,

im using dotConnect for Oracle 6.0.58.0 with .NET 4.

I've problems working with our oracle9i 9.2.0.1.0 database server. I've tried using OCI 9.2 and 11gR2. The Problems do not occur with a 11gR2 server.

The problem is, that a command using the same SQL string will not get executed correctly the second or third time, especially if the first or first two executions had thrown an exceptions (like ora-00942: table or view does not exist).

To make this even more complicated the behavior is different with 9.2 client and 11gR2 client.

For the example i've defined three simple methods:

Code: Select all

      static readonly string createScript = "create table test_table1 (id number)";
      static void Create(OracleConnection connection)
      {
         try
         {
            using (OracleCommand command = new OracleCommand(createScript, connection))
               command.ExecuteNonQuery();
            Console.WriteLine("Create: No error");
         }
         catch (Exception e) { Console.WriteLine("Create: Exception {0}", e.Message); }
      }
      static readonly string dropScript = "drop table test_table1 cascade constraints";
      static void Drop(OracleConnection connection)
      {
         try
         {
            using (OracleCommand command = new OracleCommand(dropScript, connection))
               command.ExecuteNonQuery();
            Console.WriteLine("Drop: No error");
         }
         catch (Exception e) { Console.WriteLine("Drop: Exception {0}", e.Message); }
      }
      static readonly string selectScript = "select count(*) from test_table1";
      static void Select(OracleConnection connection)
      {
         try
         {
            object result = null;
            using (OracleCommand command = new OracleCommand(dropScript, connection))
               result = command.ExecuteScalar();
            Console.WriteLine("Select: {0}", result);
         }
         catch (Exception e) { Console.WriteLine("Select: Exception {0}", e.Message); }
      }
I'm always opening the connection at the beginning:

Code: Select all

         using (var connection = new OracleConnection())
         {
            connection.Server = "oracle92";
            connection.UserId = "foo";
            connection.Password = "bar";
            connection.Open();
            //Insert example scenario here.
        }
Example with CLIENT 9.2.0.1 and SERVER 9.2.0.1.0:

Code: Select all

Create(connection); //This create does work
Drop(connection); //This drop does work
Create(connection); //This create does nothing. The table is not created.
Select(connection);

//Output
//======
//Create: No error
//Drop: No error
//Create: No error
//Select: Exception ORA-00942: Tabelle oder View nicht vorhanden
Example with CLIENT 9.2.0.1 and SERVER 9.2.0.1.0:

Code: Select all

Create(connection);
Select(connection);
Drop(connection);
Select(connection);
Select(connection);

//Output
//======
//Create: No error
//Select: 0
//Drop: No error
//Select: Exception ORA-00942: Tabelle oder View nicht vorhanden
//Select: Exception ORA-01003: keine Anweisung wurde analysiert/geparst
After the ORA-01003 that specific SQL command will always throw ORA-01003, even if you create the table again (manually).

Example with CLIENT 11.2.0.1 and SERVER 9.2.0.1.0:

Code: Select all

Create(connection); //this create does work
Select(connection);
Drop(connection); //this drop does work
Select(connection);
Select(connection);
Create(connection); //this create does work
Select(connection); //this select does still throw an exception

//Output
//======
//Create: No error
//Select: 0
//Drop: No error
//Select: Exception ORA-00942: Tabelle oder View nicht vorhanden
//Select: Exception ORA-01003: keine Anweisung wurde analysiert/geparst
//Create: No error
//Select: Exception ORA-01003: keine Anweisung wurde analysiert/geparst
I hope you can provide a workaround or fix as we still have customers with old 9.2 databases.

Thanks and with kind regards,

Bernhard
by bernhard.klefer
Thu 25 Nov 2010 10:36
Forum: dotConnect for Oracle
Topic: Find the right Oracle Client for both x86 and x64.
Replies: 5
Views: 2490

Find the right Oracle Client for both x86 and x64.

Hi,

On a system with 32 bit 11g oracle client AND 64 bit 11g oracle client installed (using different homes) it is possible to run assemblies in x86 or x64 Mode on the same system, both connecting to an oracle database.
For that the ADO.Net provider does have to find the right oracle client. System.Data.OracleClient can do that. I guess its looking the oracle home up in the registry and is automatically redirected to the Wow6432Node when running in 32 bit mode. The 'wrong' way would be to depend on environment variables like PATH which are the same for 32 and 64bit applications.

dotConnect for Oracle 5.70.190.0 does only find the client that has been installed last, so i assume its using the environment variables.

It would be really helpful if you could implement a better oracle client lookup for systems with both 32 and 64 bit oracle clients installed.

Thanks and with kind regards
Bernhard
by bernhard.klefer
Wed 24 Nov 2010 17:07
Forum: dotConnect for Oracle
Topic: Returning TableSchema(System.Data.CommandBehavior.KeyInfo)
Replies: 4
Views: 2922

Hi,

I've just tried the Express edition of dotConnect for Oracle 5.70.190.0. migrating over from Oracle's 11gR2 ODP.net for .NET4.
I'm making heavy use of .NET's abstract DbConnection, DbCommand,... and DataTable classes so i would prefer to stick with them.

I think the OracleDataReader.GetSchemaTable() behaves incorrect when returning IsUnique-Flags flags for Columns in multi-column-unique-constraint.

Microsoft's System.Data.OracleClient (.NET4) and Oracle's ODP.NET (11gR2 .NET4) both don't return IsUnique-Flags for multi-column-unique-constraints.

Example:

Code: Select all

 CONSTRAINT "UN_IMAGE_NAMESIZE" UNIQUE ("IMAGENAME", "IMAGESIZE")
meaning "not two images with same name and size".
To interprete the constraint per column would result in "only one size per image and each image has to have a distinct size"..


Returning IsUnique for these columns breaks the abstract System.Data.Common layer which interpretes the flags as individual unique-constraints on each columns.
For example the DbDataAdapter.Fill()-method creates these wrong constraints in the datatables it fills which will most likely result in an ConstraintException. See also http://www.devart.com/forums/viewtopic.php?t=11995.


using OracleDataTable would be some kind of workaround (if it was included in the express edition) but not a fix for the basic issue.

I hope you can understand my problem and provide a fix.

Thanks for your help.
With kind regards,
Bernhard