Author Topic: [SOLVED] ADODB error while creating connectors  (Read 1753 times)

coatie

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
[SOLVED] ADODB error while creating connectors
« on: July 03, 2014, 12:41:46 am »
Hello,

we wrote a plugin to support us in cloning ports including all attached provided/required interfaces and all connections bound to that port. This is working fine on some PCs but on some others not and ends up with following error message:

"Exception occurred: ADODB.Fields [-2146825023]
Item cannot be found in the collection corresponding to the requested name or ordinal.      "

So far we found that this is only raised after calling the Update() function of a newly created connector (and only for the object of type connector). For all other items, i.e. the port element and the interface elements, the creation is successful without any error.

The implementation looks like following:
EA.Element parentElement;
EA.Element newPort;

parentElement = aRepositroy.GetElementByID(portToClone.ParentID);
// create new port
newPort = (EA.Element) parentElement.Elements.AddNew(portToClone.Name + "_CLONE", portToClone.Type);

try { newPort.Update(); }
catch { Log("Error occurred: " + newPort.GetLastError()); }
parentElement.Elements.Refresh();

// take over the connectors
foreach (EA.Connector connectorToClone in portToClone.Connectors)
{
      EA.Connector newConnector;
      
      newConnector = (EA.Connector) newPort.Connectors.AddNew("", connectorToClone.Type);
      newConnector.SupplierID = connectorToClone.SupplierID;
      
      if (portToClone.ElementID == connectorToClone.ClientID)
      {
            newConnector.SupplierID = connectorToClone.SupplierID;
      }
      else
      {
            newConnector.SupplierID = connectorToClone.ClientID;
            newConnector.Direction = "Destination -> Source";
      }
      try
      {
            /*
                  while executing this call we receive the expection:
                  ADODB.Fields [-2146825023]
                  Item cannot be found in the collection corresponding to the requested name or ordinal.            
            */
            newConnector.Update();
      }
      catch
      {
            Log("Exception occurred: " + newConnector.GetLastError());
      }
      newPort.Connectors.Refresh();
}


Our EA model is located on an OracleDB server and we are using Oracle Client 11gR2 (exact same version 11.2.0.32 on all machines).

Does anybody know how we can find out what is causing this error? (Since it only occurs on some machines)

Thank you!

Best Regards
Markus
« Last Edit: August 25, 2014, 06:32:43 pm by coatie »

qwerty

  • EA Guru
  • *****
  • Posts: 9380
  • Karma: +146/-137
  • I'm no guru at all
    • View Profile
Re: ADODB error while creating connectors
« Reply #1 on: July 03, 2014, 06:06:49 am »
Markus,
you should contact Sparx support directly to get support. This sounds like something is going wrong in the very guts of EA. (There are some Oracle gurus here but I have not heard from them for some time.)

q.

coatie

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: [SOLVED] ADODB error while creating connectors
« Reply #2 on: August 25, 2014, 06:35:28 pm »
Hello,

I found a solution. It seems to be an issue of Hungarian localization of the Oracle DB drivers. When changing the sorting from "Default" to "Technical" at the Windows “Region and Language” settings the script is working fine.

Best Regards,
Markus

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8173
  • Karma: +193/-22
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: [SOLVED] ADODB error while creating connectors
« Reply #3 on: January 19, 2016, 09:09:25 pm »
Hi Markus,

We seem to be having the same issue on a MySQL database, but I can't really find the sorting setting you are referring too.
Could you please provide some more details on how you have solved the problem?

Thanks

Geert