Error 226: OpenAccess Error: Unable to reach database server on host

6 posts, 0 answers
  1. Devtron
    Devtron avatar
    2 posts
    Member since:
    Aug 2009

    Posted 08 Sep 2009 Link to this post

    Hello,

    I am building an installation package/deployment project. Everything works great in development and testing.

    Whenever I change my app.config settings to point to the production database & server, I get the following error:

    Error    226    OpenAccess Error: Unable to reach database server on host 'vmdbprod\vmdbprod2005'.
    Error Details:Unable to connect to Backend=mssql;Server=xxxx\xxx;Database=xxxx;Driver=;Integrated Security=False;;USER=Ixxxx;;ConnectOnly=true;:
    Telerik.OpenAccess.RT.sql.SQLException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(String url, IDictionary driverProps)
       at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.createRealCon()
    DBDriver: Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver
    LOCK_TIMEOUT=5000
    Please ensure that the hostname provided is valid and resolvable, verify that the machine is reachable in your network and that a database server is running on that machine. 



    My question is, how can I deploy this project, with database settings that I do not have access to? This is going onto our client's network (scheduled for tomorrow) and I am unable to build my project when pointed to their network.

    How can I bypass this or ignore this error? Why must ORM authenticate itself like this? not good!

  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 09 Sep 2009 Link to this post

    Hi Devtron,

    This might seem trivial:

    But have you ensured that your the database instance (Sql configuration) on the remote server allows tcp/ip communications. Default it is disabled.

    Regards

    Henrik
  3. DevCraft banner
  4. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 09 Sep 2009 Link to this post

    Hi Devtron,

    What Henrik pointed is usually the main cause of the issue you are facing. Unfortunately there is no way to bypass that but to enable the server on the targeted machine to accept tpc/ip connections. To do so, you will have to open the SQL Server Configuration Manager. There you should locate the protocols that are enabled for the server and check if the TCP/IP is enabled. If it is not, please enable it manually.


    Regards,
    Petar
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Dilshod
    Dilshod avatar
    23 posts
    Member since:
    Feb 2012

    Posted 02 Dec 2013 Link to this post

    Hi,
    I am having the similar issue here. I have many test cases and every time several tasks will fail when I try running them all at the same time. Failing test cases aren't random all the time. To fix the problem I need to run each failed test individually. Running them individually works fine. I am opening connection to the database at test Setup.

    Thanks,
  6. Wolfgang
    Wolfgang avatar
    98 posts
    Member since:
    Oct 2012

    Posted 03 Dec 2013 Link to this post

    I think multiple reasons can be teh problem.
    When you run the test cases in parallel, are you using multiple telerik connections? (Think about commits as end of a transaction - could they occur in parallel to some other code, like adding a object to a scope. If you have only one connection thinks will fail. )
    When you are using multiple telerik connections, how much concurrent connections will try to access the server? Is the server allowed to accept such a numer of connections?
  7. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 04 Dec 2013 Link to this post

    Hello Dilshod,

    usually the test runners execute the tests in a sequence, which means that if some of your tests cause "connection leak" when the test are executed to a given point the maximum allowed connection by your server will be reached and all tests after this point will fail. This could explain while the failing tests are not random all the time. I would suggest you go trough the tests executed before you see the first failure and check for potential connection leaks.

    Such problems could be caused by one of the following cases:

    1. using the low-level ADO API without using blocks or explicit Close()/Dispose() for the obtained OaConnection:
    var con = dbContext.Connection;
    //do something here
    //this should be:
    using(var con = dbContext.Connection)
    {
         //do something here
    }

    2. You are using Domain Methods without committing the transaction:
    var res = dbContext.CallMyStoredProcedure();
     
    //better implement it like this:
    try
    {
      var res = dbContext.CallMyStoredProcedure();
    }
    finally
    {
      //This will commit the transaction and will free the connection;
      db.SaveChanges();
    }

    3. The OpenAccessContext is not disposed at the end of the TestMethod/TestClass, you could do something like this:
    [TestInitialize]
    public void TestInit()
    {
      this.dbContext = new EntitiesModel();
    }
     
    [TestCleanup]
    public void TestCleanup()
    {
      if( this.dbContext  != null)
      {
         this.dbContext.Dispose();
         this.dbContext = null;
      }
    }

    If those hints doesn't help you to locate the problem please provide more details about the error you get.


    Regards,
    Kaloyan Nikolov
    Telerik
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top
DevCraft banner