Topic
  • 4 replies
  • Latest Post - ‏2013-12-17T23:31:41Z by JeffLindborg
Jamie_Xerox
Jamie_Xerox
2 Posts

Pinned topic Informix Error - The selected ACCEPTKEY has been pre-assigned for ISQL

‏2013-12-05T16:40:28Z |

I have a C# application that uses an ODBC connection and when I execute a certain procedure call I get the ACCEPTKEY error back.

When I use Cisco's CUDLI tool to execute the same procedure it works fine. Only when I use the ODBC connect in my C# code the store procedure fails during execution and reports an error. Error - "The selected ACCEPTKEY has been preassigned for ISQL

This is the full error that I get back:

ERROR [HY000] [Informix][Informix ODBC Driver][Informix]The selected ACCEPTKEY has been pre-assigned for ISQL sqlerrm(Object not found.  Object = [Credential], Table = [tbl_Credential], Colu)

When I look up the Error on IBMs Information Center, it says:

-1004   The selected ACCEPTKEY has been preassigned for ISQL.

The key that the ACCEPTKEY environment variable specifies is one that
IBM Informix SQL always uses. Set a different value in the environment
variable.

I have no clue what it is talking about or what to change.

Any help would be greatly appreciated.

 

Updated on 2013-12-05T16:48:39Z at 2013-12-05T16:48:39Z by Jamie_Xerox
  • Sathyanesh
    Sathyanesh
    17 Posts

    Re: Informix Error - The selected ACCEPTKEY has been pre-assigned for ISQL

    ‏2013-12-06T20:30:28Z  

    Can you please give some more information about the procedure you are trying to execute and how you are tying to execute it.

    For example the  CommandText and CommandType properties you are setting the command object.
    If you are binding any parameter then please give me information about that well.
    Also I am curious to know the .NET Framework version you are using.

  • Jamie_Xerox
    Jamie_Xerox
    2 Posts

    Re: Informix Error - The selected ACCEPTKEY has been pre-assigned for ISQL

    ‏2013-12-06T20:43:30Z  

    Can you please give some more information about the procedure you are trying to execute and how you are tying to execute it.

    For example the  CommandText and CommandType properties you are setting the command object.
    If you are binding any parameter then please give me information about that well.
    Also I am curious to know the .NET Framework version you are using.

    It is C# .NET 4.0.  There are three servers that have DBs.  The wierd thing is the the call to make the update on one of the servers works fine, but for the other two, it generates the error.

    Here is the code that I am executing:

       public static bool CredentialModify(Unity unity)
       {
        bool isModified = false;
        OdbcCommand cmd = new OdbcCommand(string.Empty, Connection.OdbcUnityConnection(unity.Server.ToString()));

        try
        {
         StringBuilder cmdText = new StringBuilder("execute procedure csp_credentialmodify(");

         cmdText.Append("pAuditAlias='" + unity.Alias + "'");
         cmdText.Append(",pAuditComponent='CUDLI'");
         cmdText.Append(",pCredentials='" + unity.PIN + "'");
         cmdText.Append(",pCredentialType='4'");
         cmdText.Append(",pCredMustChange='0'");
         cmdText.Append(",pDoesntExpire='1'");
         cmdText.Append(",pUserObjectId='" + unity.AliasId + "'");
         cmdText.Append(")");
         cmd.CommandText = cmdText.ToString();
         cmd.Connection.Open();
         cmd.ExecuteNonQuery();
         isModified = true;
        }
        finally
        {
         // If the connection is open, close it.
         if (cmd.Connection.State == ConnectionState.Open) { cmd.Connection.Close(); }
        }

        return isModified;
       }

     

  • Sathyanesh
    Sathyanesh
    17 Posts

    Re: Informix Error - The selected ACCEPTKEY has been pre-assigned for ISQL

    ‏2013-12-06T22:19:45Z  

    It is C# .NET 4.0.  There are three servers that have DBs.  The wierd thing is the the call to make the update on one of the servers works fine, but for the other two, it generates the error.

    Here is the code that I am executing:

       public static bool CredentialModify(Unity unity)
       {
        bool isModified = false;
        OdbcCommand cmd = new OdbcCommand(string.Empty, Connection.OdbcUnityConnection(unity.Server.ToString()));

        try
        {
         StringBuilder cmdText = new StringBuilder("execute procedure csp_credentialmodify(");

         cmdText.Append("pAuditAlias='" + unity.Alias + "'");
         cmdText.Append(",pAuditComponent='CUDLI'");
         cmdText.Append(",pCredentials='" + unity.PIN + "'");
         cmdText.Append(",pCredentialType='4'");
         cmdText.Append(",pCredMustChange='0'");
         cmdText.Append(",pDoesntExpire='1'");
         cmdText.Append(",pUserObjectId='" + unity.AliasId + "'");
         cmdText.Append(")");
         cmd.CommandText = cmdText.ToString();
         cmd.Connection.Open();
         cmd.ExecuteNonQuery();
         isModified = true;
        }
        finally
        {
         // If the connection is open, close it.
         if (cmd.Connection.State == ConnectionState.Open) { cmd.Connection.Close(); }
        }

        return isModified;
       }

     

    You may have to make change to EXECUTE PROCEDURE call you are making.
    Here is an example to it.

    FYI:
    Starting with CSDK 410 xC2 Informix provider supports .NET FW 4.0 as well.
    Performance will be better with Informix.NET provider when compared to ODBC bridge.

    usingSystem;

    usingSystem.Collections.Generic;

    usingSystem.Linq;

    usingSystem.Text;

    usingSystem.Data;

    usingSystem.Data.Odbc;

     

    namespaceSimpleApp

    {

    publicclassUnity

    {

    publicStringAlias

    {

    get

    {

    return"MyAliasValue";

    }

    }

    publicStringPIN

    {

    get

    {

    return"MyPinValue";

    }

    }

     

    publicStringAliasId

    {

    get

    {

    return"MyAliasIDValue";

    }

    }

    };

    classProgram

    {

    staticvoidMain(string[] args)

    {

    Unityunity = newUnity();

    try

    {

    OdbcConnectionConn = newOdbcConnection("DSN=mydsn");

    Conn.Open();

     

    OdbcCommandCmd = Conn.CreateCommand();

    Cmd.CommandText = @"CREATE PROCEDURE my_csp_credentialmodify

    (

    pAuditAlias char(20)

    ,pAuditComponent char(20)

    ,pCredentials char(20)

    ,pCredentialType INT

    ,pCredMustChange INT

    ,pDoesntExpire INT

    ,pUserObjectId char(20)

    )

    END PROCEDURE;";

    Cmd.ExecuteNonQuery();

    StringBuildercmdText = newStringBuilder(@"EXECUTE PROCEDURE my_csp_credentialmodify ( ");

    cmdText.Append("'"+ unity.Alias + "'");

    cmdText.Append(", 'CUDLI'");

    cmdText.Append(",'"+ unity.PIN + "'");

    cmdText.Append(", 4");

    cmdText.Append(", 0");

    cmdText.Append(", 1");

    cmdText.Append(",'"+ unity.AliasId + "'");

    cmdText.Append(")");

    Cmd.CommandText = cmdText.ToString();

    Cmd.ExecuteNonQuery();

    Conn.Close();

    }

    catch(Exceptione)

    {

    Console.WriteLine(e.ToString());

    }

    }

    }

    }


     

     

  • JeffLindborg
    JeffLindborg
    1 Post

    Re: Informix Error - The selected ACCEPTKEY has been pre-assigned for ISQL

    ‏2013-12-17T23:31:41Z  

    You may have to make change to EXECUTE PROCEDURE call you are making.
    Here is an example to it.

    FYI:
    Starting with CSDK 410 xC2 Informix provider supports .NET FW 4.0 as well.
    Performance will be better with Informix.NET provider when compared to ODBC bridge.

    usingSystem;

    usingSystem.Collections.Generic;

    usingSystem.Linq;

    usingSystem.Text;

    usingSystem.Data;

    usingSystem.Data.Odbc;

     

    namespaceSimpleApp

    {

    publicclassUnity

    {

    publicStringAlias

    {

    get

    {

    return"MyAliasValue";

    }

    }

    publicStringPIN

    {

    get

    {

    return"MyPinValue";

    }

    }

     

    publicStringAliasId

    {

    get

    {

    return"MyAliasIDValue";

    }

    }

    };

    classProgram

    {

    staticvoidMain(string[] args)

    {

    Unityunity = newUnity();

    try

    {

    OdbcConnectionConn = newOdbcConnection("DSN=mydsn");

    Conn.Open();

     

    OdbcCommandCmd = Conn.CreateCommand();

    Cmd.CommandText = @"CREATE PROCEDURE my_csp_credentialmodify

    (

    pAuditAlias char(20)

    ,pAuditComponent char(20)

    ,pCredentials char(20)

    ,pCredentialType INT

    ,pCredMustChange INT

    ,pDoesntExpire INT

    ,pUserObjectId char(20)

    )

    END PROCEDURE;";

    Cmd.ExecuteNonQuery();

    StringBuildercmdText = newStringBuilder(@"EXECUTE PROCEDURE my_csp_credentialmodify ( ");

    cmdText.Append("'"+ unity.Alias + "'");

    cmdText.Append(", 'CUDLI'");

    cmdText.Append(",'"+ unity.PIN + "'");

    cmdText.Append(", 4");

    cmdText.Append(", 0");

    cmdText.Append(", 1");

    cmdText.Append(",'"+ unity.AliasId + "'");

    cmdText.Append(")");

    Cmd.CommandText = cmdText.ToString();

    Cmd.ExecuteNonQuery();

    Conn.Close();

    }

    catch(Exceptione)

    {

    Console.WriteLine(e.ToString());

    }

    }

    }

    }


     

     

    In fact CUDLI is nice enough to provide an interface that shows you this construction directly... if you go into view | stored procedures and select the csp_credntialmodify stored proc and hit "execute" it comes up with a screen showing the params and the data dictionary details for each one - fill it in and you can either execute it directly with the "Execute" button or use the "show command" to get the full query construction complete with type casts and all that good stuff...