简体   繁体   中英

Unable to set timeout property for ADOMDConnection class

I am using AdomdConnection connection class to connect to the Cube. I am using following code.

 using (var conn = new AdomdConnection(ConnString))
        {
            conn.Open();
            var cube = conn.Cubes[name];
            //Do something
            conn.Close();
        }

AdomdConnection.ConnectionTimeout Property does not have setter property.

The default value for connectionTimeOut property is 0, which sets the time to infinite.

I have two questions:

  1. Is there any way to set the timeout property for AdomdConnection?
  2. When the cube is busy and your try to run the program, after creating the connection when you open the connection (conn.open()), system does not come out of this statement & never executes the next line of code. In such cases the application becomes irresponsible and there is no exception thrown. How can I inform user about such scenarios & make a log entry.

I looked into this similar tread but did not found it useful.

Thank you

The documentation states this for AdomdConnection.ConnectionTimeout

Gets the time to wait for a connection to be established before the AdomdConnection stops trying to connect and generates an error.

So that means the timeout just talking to the server.

If you want a timeout when your running an actual command use the AdomdCommand.CommandTimeout property.

Gets or sets the time to wait for a command to run before the AdomdCommand stops trying to run the command and generates an error.

Both can be set with the connection string.

http://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM