Problem with DB2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pkoeppe
    New Member
    • Dec 2007
    • 3

    #1

    Problem with DB2

    Hello

    I have the following problem. When I start my program (C#) I create an OleDbConnection to a DB2 and use this connection for different requests. But after about 8 minutes I get the following error: "OleDbExcep tion System.Data.Ole Db.OleDbExcepti on: [DB2/6000] SQL0551N "xxx" does not have the privilege to perform operation "EXECUTE" on object "NULLID.yyy ". SQLSTATE=42501" . What does that mean???

    Thanks for your help.

    Greets
    pkoeppe
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    This message indicates that the user does not have the REFERENCES privilege. You doesn't have execute permission on the object you are using.

    Comment

    • pkoeppe
      New Member
      • Dec 2007
      • 3

      #3
      But why it works in the first 8 minutes? In the first 8 minutes I also send requests and it works, after 8 minutes (the request is 100% the same) I get the error. Why???

      For a work around I open a new connection for each request and close the connection after the request. But here the connection seems not to be closed really. The connection state is closed but the database says there is still a connection. After some request I get the error "Open Connection failed System.Data.Ole Db.OleDbExcepti on: SQL1226N The maximum number of client connections are already started. SQLSTATE=57030" . I don't unterstand this, I close each connection after the request. When I close my program then the connections are closed "really", what is the problem???

      Greets
      pkoeppe

      Comment

      • pkoeppe
        New Member
        • Dec 2007
        • 3

        #4
        Does nobody have an idea?

        That's the way I do my requests now, but also there is the problem that for each request a new real connection is opened and not really closed. My DBA says there are x connections after x requests. How can I avoid this? How can I clear the connection to the DB really???

        Code:
        public DataTable Request()
        {
          try
          {
            using (OleDbConnection connection = new OleDbConnection(Constants.DB2_CONNECTION_STRING))
            {
              using (OleDbDataAdapter da = new OleDbDataAdapter(request, connection))
              {
                using (DataTable dtResult = new DataTable())
                {
                  da.Fill(dtResult);
                  return dtResult;
                }
              }
            }
          }
          catch (Exception ex)
          {
            MessageBox.Show(ex.ToString());
          }
          return null;
        }

        Comment

        Working...