RE: SQL Timeout Error

Discussion in 'ASP .Net' started by =?Utf-8?B?QW1pdA==?=, Dec 8, 2006.

  1. How do I check if SQL allows remote connections and has mixed mode
    authentication? I checked the "remote login timeout" for SQL server and its
    set at 2000. Is this the setting you're referring to?

    I can run another web application in .net 2.0 fine when I explicitly set the
    connect timeout setting to 2000 in the connection string.

    "Peter Bromberg [C# MVP]" wrote:

    > Make sure your SQL Server is allowing remote connections and has mixed mode
    > (Windows and SQL Server) authentication enabled. Make a page with nothing but
    > a a sample connection and try / catch so you can output the result of any
    > exception Message and stacktrace.
    > Peter
    >
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "Amit" wrote:
    >
    > > I have a development setup as follows:
    > >
    > > 2 machines both running win xp pro, with machine A running .net 2.0 and
    > > machine B acting as my database server running sql server 2000.
    > >
    > > I want to use ASP.NET 2.0 new forms authentication configuration tools but I
    > > want the information stored in my sql server 2000 database rather than the
    > > standard sql express database. I ran aspnet_regsql.exe from machine A,
    > > specified machine B as the server and provided the sql server userid and
    > > password; however, it cannot connect and gives a timeout exception.
    > >
    > > The second machine is running as I can see it in windows explorer, and can
    > > connect to the database from machine A's SQL Server Enterprise manager.
    > >
    > > Could a possible problem be that I need to install .net 2.0 on my database
    > > server (machine B)? Currently, its running .net 1.1 but I wouldn't think
    > > that would make a difference as its just the database server. Machine B is
    > > running wirelessly through a netgear router.
     
    =?Utf-8?B?QW1pdA==?=, Dec 8, 2006
    #1
    1. Advertising

  2. I still can't get .net 2.0 to connect to sql server 2000 instance.

    I opened another application in vs 2003 and the remote connection worked
    fine so I don't think its the database or wireless connection. There must be
    some setting in .net 2.0 thats different. Is there a different way to write
    the connection string? Please somebody help. I'm at a loss. The database
    is configured with the following values, where the columns are minimum,
    maximum, config value, and run value. As you can see remote access is
    enabled, the login timeout is set at 2000 seconds, and remote query timeout
    is set at infinite.

    remote access 0 1 1 1
    remote login timeout (s) 0 2147483647 2000 2000
    remote proc trans 0 1 0 0
    remote query timeout (s) 0 2147483647 0 0

    I'm running out of variables to test.


    "Amit" wrote:

    > Well, its definitely not anything to do with a query. I'm assuming I should
    > be able to get the aspnet_regsql.exe tool to connect to the database, which I
    > cannot. Is there a way to set the timeout of the aspnet_regsql tool or
    > should I try to change the timeout of sqlserver?
    >
    > Why would an error like this even happen?
    >
    > "Peter Bromberg [C# MVP]" wrote:
    >
    > > You have two potential Timeouts to deal with:
    > >
    > > The ADO.NET SqlCommand has a CommandTimeout property. And the SqlConnection
    > > has a timeout property. Your command can timeout on a long running query and
    > > that has nothing to do with your connection.
    > > Hope that helps.
    > > Peter
    > >
    > > --
    > > Co-founder, Eggheadcafe.com developer portal:
    > > http://www.eggheadcafe.com
    > > UnBlog:
    > > http://petesbloggerama.blogspot.com
    > >
    > >
    > >
    > >
    > > "Amit" wrote:
    > >
    > > > How do you increase the SQL Server timeout? Is it the login timeout or
    > > > transaction timeout I should increase? I guess I'm confused on why one
    > > > application that I upgraded to asp.net2.0 works (although I had to increase
    > > > the timeout in the connection string) while everything else seems to timeout.
    > > >
    > > > "Peter Bromberg [C# MVP]" wrote:
    > > >
    > > > > For SQL Server 2000, In Enterprise Manager, right click the Database in the
    > > > > Left pane, and choose properties.
    > > > >
    > > > > In the Security tab, you need "Sql Server and Windows" radio. In the
    > > > > Connection Tab, you need "Allow other SQL Servers..." if you have other
    > > > > Databases that need to connect to it.
    > > > >
    > > > > Peter
    > > > >
    > > > > --
    > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > http://www.eggheadcafe.com
    > > > > UnBlog:
    > > > > http://petesbloggerama.blogspot.com
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Amit" wrote:
    > > > >
    > > > > > How do I check if SQL allows remote connections and has mixed mode
    > > > > > authentication? I checked the "remote login timeout" for SQL server and its
    > > > > > set at 2000. Is this the setting you're referring to?
    > > > > >
    > > > > > I can run another web application in .net 2.0 fine when I explicitly set the
    > > > > > connect timeout setting to 2000 in the connection string.
    > > > > >
    > > > > > "Peter Bromberg [C# MVP]" wrote:
    > > > > >
    > > > > > > Make sure your SQL Server is allowing remote connections and has mixed mode
    > > > > > > (Windows and SQL Server) authentication enabled. Make a page with nothing but
    > > > > > > a a sample connection and try / catch so you can output the result of any
    > > > > > > exception Message and stacktrace.
    > > > > > > Peter
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > > > http://www.eggheadcafe.com
    > > > > > > UnBlog:
    > > > > > > http://petesbloggerama.blogspot.com
    > > > > > >

    >
     
    =?Utf-8?B?QW1pdA==?=, Dec 9, 2006
    #2
    1. Advertising

  3. try connectionstrings.com.
    a typical connection string (simplified version):
    "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Amit" wrote:

    > I still can't get .net 2.0 to connect to sql server 2000 instance.
    >
    > I opened another application in vs 2003 and the remote connection worked
    > fine so I don't think its the database or wireless connection. There must be
    > some setting in .net 2.0 thats different. Is there a different way to write
    > the connection string? Please somebody help. I'm at a loss. The database
    > is configured with the following values, where the columns are minimum,
    > maximum, config value, and run value. As you can see remote access is
    > enabled, the login timeout is set at 2000 seconds, and remote query timeout
    > is set at infinite.
    >
    > remote access 0 1 1 1
    > remote login timeout (s) 0 2147483647 2000 2000
    > remote proc trans 0 1 0 0
    > remote query timeout (s) 0 2147483647 0 0
    >
    > I'm running out of variables to test.
    >
    >
    > "Amit" wrote:
    >
    > > Well, its definitely not anything to do with a query. I'm assuming I should
    > > be able to get the aspnet_regsql.exe tool to connect to the database, which I
    > > cannot. Is there a way to set the timeout of the aspnet_regsql tool or
    > > should I try to change the timeout of sqlserver?
    > >
    > > Why would an error like this even happen?
    > >
    > > "Peter Bromberg [C# MVP]" wrote:
    > >
    > > > You have two potential Timeouts to deal with:
    > > >
    > > > The ADO.NET SqlCommand has a CommandTimeout property. And the SqlConnection
    > > > has a timeout property. Your command can timeout on a long running query and
    > > > that has nothing to do with your connection.
    > > > Hope that helps.
    > > > Peter
    > > >
    > > > --
    > > > Co-founder, Eggheadcafe.com developer portal:
    > > > http://www.eggheadcafe.com
    > > > UnBlog:
    > > > http://petesbloggerama.blogspot.com
    > > >
    > > >
    > > >
    > > >
    > > > "Amit" wrote:
    > > >
    > > > > How do you increase the SQL Server timeout? Is it the login timeout or
    > > > > transaction timeout I should increase? I guess I'm confused on why one
    > > > > application that I upgraded to asp.net2.0 works (although I had to increase
    > > > > the timeout in the connection string) while everything else seems to timeout.
    > > > >
    > > > > "Peter Bromberg [C# MVP]" wrote:
    > > > >
    > > > > > For SQL Server 2000, In Enterprise Manager, right click the Database in the
    > > > > > Left pane, and choose properties.
    > > > > >
    > > > > > In the Security tab, you need "Sql Server and Windows" radio. In the
    > > > > > Connection Tab, you need "Allow other SQL Servers..." if you have other
    > > > > > Databases that need to connect to it.
    > > > > >
    > > > > > Peter
    > > > > >
    > > > > > --
    > > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > > http://www.eggheadcafe.com
    > > > > > UnBlog:
    > > > > > http://petesbloggerama.blogspot.com
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > > "Amit" wrote:
    > > > > >
    > > > > > > How do I check if SQL allows remote connections and has mixed mode
    > > > > > > authentication? I checked the "remote login timeout" for SQL server and its
    > > > > > > set at 2000. Is this the setting you're referring to?
    > > > > > >
    > > > > > > I can run another web application in .net 2.0 fine when I explicitly set the
    > > > > > > connect timeout setting to 2000 in the connection string.
    > > > > > >
    > > > > > > "Peter Bromberg [C# MVP]" wrote:
    > > > > > >
    > > > > > > > Make sure your SQL Server is allowing remote connections and has mixed mode
    > > > > > > > (Windows and SQL Server) authentication enabled. Make a page with nothing but
    > > > > > > > a a sample connection and try / catch so you can output the result of any
    > > > > > > > exception Message and stacktrace.
    > > > > > > > Peter
    > > > > > > >
    > > > > > > >
    > > > > > > > --
    > > > > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > > > > http://www.eggheadcafe.com
    > > > > > > > UnBlog:
    > > > > > > > http://petesbloggerama.blogspot.com
    > > > > > > >

    > >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Dec 9, 2006
    #3
  4. That didn't work. I'm not supposed to enter a connection string like that in
    the aspnet_regsql tool.

    "Peter Bromberg [C# MVP]" wrote:

    > try connectionstrings.com.
    > a typical connection string (simplified version):
    > "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "Amit" wrote:
    >
    > > I still can't get .net 2.0 to connect to sql server 2000 instance.
    > >
    > > I opened another application in vs 2003 and the remote connection worked
    > > fine so I don't think its the database or wireless connection. There must be
    > > some setting in .net 2.0 thats different. Is there a different way to write
    > > the connection string? Please somebody help. I'm at a loss. The database
    > > is configured with the following values, where the columns are minimum,
    > > maximum, config value, and run value. As you can see remote access is
    > > enabled, the login timeout is set at 2000 seconds, and remote query timeout
    > > is set at infinite.
    > >
    > > remote access 0 1 1 1
    > > remote login timeout (s) 0 2147483647 2000 2000
    > > remote proc trans 0 1 0 0
    > > remote query timeout (s) 0 2147483647 0 0
    > >
    > > I'm running out of variables to test.
    > >
    > >
    > > "Amit" wrote:
    > >
    > > > Well, its definitely not anything to do with a query. I'm assuming I should
    > > > be able to get the aspnet_regsql.exe tool to connect to the database, which I
    > > > cannot. Is there a way to set the timeout of the aspnet_regsql tool or
    > > > should I try to change the timeout of sqlserver?
    > > >
    > > > Why would an error like this even happen?
    > > >
    > > > "Peter Bromberg [C# MVP]" wrote:
    > > >
    > > > > You have two potential Timeouts to deal with:
    > > > >
    > > > > The ADO.NET SqlCommand has a CommandTimeout property. And the SqlConnection
    > > > > has a timeout property. Your command can timeout on a long running query and
    > > > > that has nothing to do with your connection.
    > > > > Hope that helps.
    > > > > Peter
    > > > >
    > > > > --
    > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > http://www.eggheadcafe.com
    > > > > UnBlog:
    > > > > http://petesbloggerama.blogspot.com
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Amit" wrote:
    > > > >
    > > > > > How do you increase the SQL Server timeout? Is it the login timeout or
    > > > > > transaction timeout I should increase? I guess I'm confused on why one
    > > > > > application that I upgraded to asp.net2.0 works (although I had to increase
    > > > > > the timeout in the connection string) while everything else seems to timeout.
    > > > > >
    > > > > > "Peter Bromberg [C# MVP]" wrote:
    > > > > >
    > > > > > > For SQL Server 2000, In Enterprise Manager, right click the Database in the
    > > > > > > Left pane, and choose properties.
    > > > > > >
    > > > > > > In the Security tab, you need "Sql Server and Windows" radio. In the
    > > > > > > Connection Tab, you need "Allow other SQL Servers..." if you have other
    > > > > > > Databases that need to connect to it.
    > > > > > >
    > > > > > > Peter
    > > > > > >
    > > > > > > --
    > > > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > > > http://www.eggheadcafe.com
    > > > > > > UnBlog:
    > > > > > > http://petesbloggerama.blogspot.com
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > "Amit" wrote:
    > > > > > >
    > > > > > > > How do I check if SQL allows remote connections and has mixed mode
    > > > > > > > authentication? I checked the "remote login timeout" for SQL server and its
    > > > > > > > set at 2000. Is this the setting you're referring to?
    > > > > > > >
    > > > > > > > I can run another web application in .net 2.0 fine when I explicitly set the
    > > > > > > > connect timeout setting to 2000 in the connection string.
    > > > > > > >
    > > > > > > > "Peter Bromberg [C# MVP]" wrote:
    > > > > > > >
    > > > > > > > > Make sure your SQL Server is allowing remote connections and has mixed mode
    > > > > > > > > (Windows and SQL Server) authentication enabled. Make a page with nothing but
    > > > > > > > > a a sample connection and try / catch so you can output the result of any
    > > > > > > > > exception Message and stacktrace.
    > > > > > > > > Peter
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > --
    > > > > > > > > Co-founder, Eggheadcafe.com developer portal:
    > > > > > > > > http://www.eggheadcafe.com
    > > > > > > > > UnBlog:
    > > > > > > > > http://petesbloggerama.blogspot.com
    > > > > > > > >
    > > >
     
    =?Utf-8?B?QW1pdA==?=, Dec 9, 2006
    #4
  5. Hello Amit,

    You should try a small .NET 2.0 console application that connects to the
    SQL Server 2000 using the following connection string to check if that works:

    If you are using a trusted connection:
    server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;

    Otherwise:
    server=SERVER;UID=userid;PWD=password;

    using System.Data.SqlClient;

    namespace ConsoleApplication1
    {
    internal class Program
    {
    private static void Main(string[] args)
    {
    string connectionString = "server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;";
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
    connection.Open();
    }
    }
    }
    }

    Gabriel Lozano-Morán
    The .NET Aficionado
    http://www.pointerx.net



    > That didn't work. I'm not supposed to enter a connection string like
    > that in the aspnet_regsql tool.
    >
    > "Peter Bromberg [C# MVP]" wrote:
    >
    >> try connectionstrings.com.
    >> a typical connection string (simplified version):
    >> "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    >> --
    >> Co-founder, Eggheadcafe.com developer portal:
    >> http://www.eggheadcafe.com
    >> UnBlog:
    >> http://petesbloggerama.blogspot.com
    >> "Amit" wrote:
    >>
    >>> I still can't get .net 2.0 to connect to sql server 2000 instance.
    >>>
    >>> I opened another application in vs 2003 and the remote connection
    >>> worked fine so I don't think its the database or wireless
    >>> connection. There must be some setting in .net 2.0 thats different.
    >>> Is there a different way to write the connection string? Please
    >>> somebody help. I'm at a loss. The database is configured with the
    >>> following values, where the columns are minimum, maximum, config
    >>> value, and run value. As you can see remote access is enabled, the
    >>> login timeout is set at 2000 seconds, and remote query timeout is
    >>> set at infinite.
    >>>
    >>> remote access 0 1 1 1
    >>> remote login timeout (s) 0 2147483647 2000 2000
    >>> remote proc trans 0 1 0 0
    >>> remote query timeout (s) 0 2147483647 0 0
    >>> I'm running out of variables to test.
    >>>
    >>> "Amit" wrote:
    >>>
    >>>> Well, its definitely not anything to do with a query. I'm assuming
    >>>> I should be able to get the aspnet_regsql.exe tool to connect to
    >>>> the database, which I cannot. Is there a way to set the timeout of
    >>>> the aspnet_regsql tool or should I try to change the timeout of
    >>>> sqlserver?
    >>>>
    >>>> Why would an error like this even happen?
    >>>>
    >>>> "Peter Bromberg [C# MVP]" wrote:
    >>>>
    >>>>> You have two potential Timeouts to deal with:
    >>>>>
    >>>>> The ADO.NET SqlCommand has a CommandTimeout property. And the
    >>>>> SqlConnection
    >>>>> has a timeout property. Your command can timeout on a long running
    >>>>> query and
    >>>>> that has nothing to do with your connection.
    >>>>> Hope that helps.
    >>>>> Peter
    >>>>> --
    >>>>> Co-founder, Eggheadcafe.com developer portal:
    >>>>> http://www.eggheadcafe.com
    >>>>> UnBlog:
    >>>>> http://petesbloggerama.blogspot.com
    >>>>> "Amit" wrote:
    >>>>>
    >>>>>> How do you increase the SQL Server timeout? Is it the login
    >>>>>> timeout or transaction timeout I should increase? I guess I'm
    >>>>>> confused on why one application that I upgraded to asp.net2.0
    >>>>>> works (although I had to increase the timeout in the connection
    >>>>>> string) while everything else seems to timeout.
    >>>>>>
    >>>>>> "Peter Bromberg [C# MVP]" wrote:
    >>>>>>
    >>>>>>> For SQL Server 2000, In Enterprise Manager, right click the
    >>>>>>> Database in the Left pane, and choose properties.
    >>>>>>>
    >>>>>>> In the Security tab, you need "Sql Server and Windows" radio. In
    >>>>>>> the Connection Tab, you need "Allow other SQL Servers..." if you
    >>>>>>> have other Databases that need to connect to it.
    >>>>>>>
    >>>>>>> Peter
    >>>>>>>
    >>>>>>> --
    >>>>>>> Co-founder, Eggheadcafe.com developer portal:
    >>>>>>> http://www.eggheadcafe.com
    >>>>>>> UnBlog:
    >>>>>>> http://petesbloggerama.blogspot.com
    >>>>>>> "Amit" wrote:
    >>>>>>>
    >>>>>>>> How do I check if SQL allows remote connections and has mixed
    >>>>>>>> mode authentication? I checked the "remote login timeout" for
    >>>>>>>> SQL server and its set at 2000. Is this the setting you're
    >>>>>>>> referring to?
    >>>>>>>>
    >>>>>>>> I can run another web application in .net 2.0 fine when I
    >>>>>>>> explicitly set the connect timeout setting to 2000 in the
    >>>>>>>> connection string.
    >>>>>>>>
    >>>>>>>> "Peter Bromberg [C# MVP]" wrote:
    >>>>>>>>
    >>>>>>>>> Make sure your SQL Server is allowing remote connections and
    >>>>>>>>> has mixed mode
    >>>>>>>>> (Windows and SQL Server) authentication enabled. Make a page
    >>>>>>>>> with nothing but
    >>>>>>>>> a a sample connection and try / catch so you can output the
    >>>>>>>>> result of any
    >>>>>>>>> exception Message and stacktrace.
    >>>>>>>>> Peter
    >>>>>>>>> --
    >>>>>>>>> Co-founder, Eggheadcafe.com developer portal:
    >>>>>>>>> http://www.eggheadcafe.com
    >>>>>>>>> UnBlog:
    >>>>>>>>> http://petesbloggerama.blogspot.com
     
    =?iso-8859-1?Q?Gabriel=20Lozano-Mor=e1n?=, Dec 9, 2006
    #5
  6. No that didn't work either. The following is my code in a windows form.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Dim connectionString As String =
    "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=****;"
    Dim connection As SqlConnection = New SqlConnection(connectionString)

    Try
    connection.Open()
    MessageBox.Show("The connection Opened")
    connection.Close()
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    End Try
    End Sub

    However, if I change the connection string to
    Dim connectionString As String =
    "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=*****;Connect
    Timeout=2000;"

    it then works. Unfortunately, how can I change the timeout for
    aspnet_regsql.exe?

    "Gabriel Lozano-Morán" wrote:

    > Hello Amit,
    >
    > You should try a small .NET 2.0 console application that connects to the
    > SQL Server 2000 using the following connection string to check if that works:
    >
    > If you are using a trusted connection:
    > server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;
    >
    > Otherwise:
    > server=SERVER;UID=userid;PWD=password;
    >
    > using System.Data.SqlClient;
    >
    > namespace ConsoleApplication1
    > {
    > internal class Program
    > {
    > private static void Main(string[] args)
    > {
    > string connectionString = "server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;";
    > using (SqlConnection connection = new SqlConnection(connectionString))
    > {
    > connection.Open();
    > }
    > }
    > }
    > }
    >
    > Gabriel Lozano-Morán
    > The .NET Aficionado
    > http://www.pointerx.net
    >
    >
    >
    > > That didn't work. I'm not supposed to enter a connection string like
    > > that in the aspnet_regsql tool.
    > >
    > > "Peter Bromberg [C# MVP]" wrote:
    > >
    > >> try connectionstrings.com.
    > >> a typical connection string (simplified version):
    > >> "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    > >> --
    > >> Co-founder, Eggheadcafe.com developer portal:
    > >> http://www.eggheadcafe.com
    > >> UnBlog:
    > >> http://petesbloggerama.blogspot.com
    > >> "Amit" wrote:
    > >>
    > >>> I still can't get .net 2.0 to connect to sql server 2000 instance.
    > >>>
    > >>> I opened another application in vs 2003 and the remote connection
    > >>> worked fine so I don't think its the database or wireless
    > >>> connection. There must be some setting in .net 2.0 thats different.
    > >>> Is there a different way to write the connection string? Please
    > >>> somebody help. I'm at a loss. The database is configured with the
    > >>> following values, where the columns are minimum, maximum, config
    > >>> value, and run value. As you can see remote access is enabled, the
    > >>> login timeout is set at 2000 seconds, and remote query timeout is
    > >>> set at infinite.
    > >>>
    > >>> remote access 0 1 1 1
    > >>> remote login timeout (s) 0 2147483647 2000 2000
    > >>> remote proc trans 0 1 0 0
    > >>> remote query timeout (s) 0 2147483647 0 0
    > >>> I'm running out of variables to test.
    > >>>
    > >>> "Amit" wrote:
    > >>>
    > >>>> Well, its definitely not anything to do with a query. I'm assuming
    > >>>> I should be able to get the aspnet_regsql.exe tool to connect to
    > >>>> the database, which I cannot. Is there a way to set the timeout of
    > >>>> the aspnet_regsql tool or should I try to change the timeout of
    > >>>> sqlserver?
    > >>>>
    > >>>> Why would an error like this even happen?
    > >>>>
     
    =?Utf-8?B?QW1pdA==?=, Dec 9, 2006
    #6
  7. Hello Amit,

    As far as I know the connection timeout is defaulted to 15 secs unless you
    specify the connection timeout in the connection string. Maybe it is worth
    investigating why it takes longer than 15 seconds to open the connection.
    Maybe you could ask on the SQL Server newsgroup what can cause that opening
    a connection takes longer than 15 secs.

    One trick you could try is to use a trusted connection but adding the connection
    timeout value in the textbox for the server name:

    Nightcrawler;Connect Timeout=2000

    When the connection string is constructed the ASPNET_REGSQL will pick this
    text and inject it into the connection string with other words there are
    no validations done so this might actually work, I haven't tried it myself
    though.

    Gabriel Lozano-Morán
    The .NET Aficionado
    http://www.pointerx.net


    > No that didn't work either. The following is my code in a windows
    > form.
    >
    > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > Dim connectionString As String =
    > "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=****;"
    > Dim connection As SqlConnection = New
    > SqlConnection(connectionString)
    > Try
    > connection.Open()
    > MessageBox.Show("The connection Opened")
    > connection.Close()
    > Catch ex As Exception
    > MessageBox.Show(ex.Message)
    > End Try
    > End Sub
    > However, if I change the connection string to Dim connectionString As
    > String =
    > "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=*****;Connect
    > Timeout=2000;"
    >
    > it then works. Unfortunately, how can I change the timeout for
    > aspnet_regsql.exe?
    >
    > "Gabriel Lozano-Morán" wrote:
    >
    >> Hello Amit,
    >>
    >> You should try a small .NET 2.0 console application that connects to
    >> the SQL Server 2000 using the following connection string to check if
    >> that works:
    >>
    >> If you are using a trusted connection:
    >> server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;
    >> Otherwise:
    >> server=SERVER;UID=userid;PWD=password;
    >> using System.Data.SqlClient;
    >>
    >> namespace ConsoleApplication1
    >> {
    >> internal class Program
    >> {
    >> private static void Main(string[] args)
    >> {
    >> string connectionString =
    >> "server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;";
    >> using (SqlConnection connection = new
    >> SqlConnection(connectionString))
    >> {
    >> connection.Open();
    >> }
    >> }
    >> }
    >> }
    >> Gabriel Lozano-Morán
    >> The .NET Aficionado
    >> http://www.pointerx.net
    >>> That didn't work. I'm not supposed to enter a connection string
    >>> like that in the aspnet_regsql tool.
    >>>
    >>> "Peter Bromberg [C# MVP]" wrote:
    >>>
    >>>> try connectionstrings.com.
    >>>> a typical connection string (simplified version):
    >>>> "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    >>>> --
    >>>> Co-founder, Eggheadcafe.com developer portal:
    >>>> http://www.eggheadcafe.com
    >>>> UnBlog:
    >>>> http://petesbloggerama.blogspot.com
    >>>> "Amit" wrote:
    >>>>> I still can't get .net 2.0 to connect to sql server 2000 instance.
    >>>>>
    >>>>> I opened another application in vs 2003 and the remote connection
    >>>>> worked fine so I don't think its the database or wireless
    >>>>> connection. There must be some setting in .net 2.0 thats
    >>>>> different. Is there a different way to write the connection
    >>>>> string? Please somebody help. I'm at a loss. The database is
    >>>>> configured with the following values, where the columns are
    >>>>> minimum, maximum, config value, and run value. As you can see
    >>>>> remote access is enabled, the login timeout is set at 2000
    >>>>> seconds, and remote query timeout is set at infinite.
    >>>>>
    >>>>> remote access 0 1 1 1
    >>>>> remote login timeout (s) 0 2147483647 2000 2000
    >>>>> remote proc trans 0 1 0 0
    >>>>> remote query timeout (s) 0 2147483647 0 0
    >>>>> I'm running out of variables to test.
    >>>>> "Amit" wrote:
    >>>>>
    >>>>>> Well, its definitely not anything to do with a query. I'm
    >>>>>> assuming I should be able to get the aspnet_regsql.exe tool to
    >>>>>> connect to the database, which I cannot. Is there a way to set
    >>>>>> the timeout of the aspnet_regsql tool or should I try to change
    >>>>>> the timeout of sqlserver?
    >>>>>>
    >>>>>> Why would an error like this even happen?
    >>>>>>
     
    =?iso-8859-1?Q?Gabriel=20Lozano-Mor=e1n?=, Dec 9, 2006
    #7
  8. About the trick it doesn't have to be a trusted connection I don't even know
    why I typed that :)

    Gabriel Lozano-Morán
    The .NET Aficionado
    http://www.pointerx.net


    "Gabriel Lozano-Morán" <> wrote in message
    news:...
    > Hello Amit,
    >
    > As far as I know the connection timeout is defaulted to 15 secs unless you
    > specify the connection timeout in the connection string. Maybe it is worth
    > investigating why it takes longer than 15 seconds to open the connection.
    > Maybe you could ask on the SQL Server newsgroup what can cause that
    > opening a connection takes longer than 15 secs.
    >
    > One trick you could try is to use a trusted connection but adding the
    > connection timeout value in the textbox for the server name:
    >
    > Nightcrawler;Connect Timeout=2000
    >
    > When the connection string is constructed the ASPNET_REGSQL will pick this
    > text and inject it into the connection string with other words there are
    > no validations done so this might actually work, I haven't tried it myself
    > though.
    >
    > Gabriel Lozano-Morán
    > The .NET Aficionado
    > http://www.pointerx.net
    >
    >
    >> No that didn't work either. The following is my code in a windows
    >> form.
    >>
    >> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
    >> System.EventArgs) Handles MyBase.Load
    >> Dim connectionString As String =
    >> "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=****;"
    >> Dim connection As SqlConnection = New
    >> SqlConnection(connectionString)
    >> Try
    >> connection.Open()
    >> MessageBox.Show("The connection Opened")
    >> connection.Close()
    >> Catch ex As Exception
    >> MessageBox.Show(ex.Message)
    >> End Try
    >> End Sub
    >> However, if I change the connection string to Dim connectionString As
    >> String =
    >> "Server=Nightcrawler;Database=Overbored;uid=RAINDLA;pwd=*****;Connect
    >> Timeout=2000;"
    >>
    >> it then works. Unfortunately, how can I change the timeout for
    >> aspnet_regsql.exe?
    >>
    >> "Gabriel Lozano-Morán" wrote:
    >>
    >>> Hello Amit,
    >>>
    >>> You should try a small .NET 2.0 console application that connects to
    >>> the SQL Server 2000 using the following connection string to check if
    >>> that works:
    >>>
    >>> If you are using a trusted connection:
    >>> server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;
    >>> Otherwise:
    >>> server=SERVER;UID=userid;PWD=password;
    >>> using System.Data.SqlClient;
    >>>
    >>> namespace ConsoleApplication1
    >>> {
    >>> internal class Program
    >>> {
    >>> private static void Main(string[] args)
    >>> {
    >>> string connectionString =
    >>> "server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;";
    >>> using (SqlConnection connection = new
    >>> SqlConnection(connectionString))
    >>> {
    >>> connection.Open();
    >>> }
    >>> }
    >>> }
    >>> }
    >>> Gabriel Lozano-Morán
    >>> The .NET Aficionado
    >>> http://www.pointerx.net
    >>>> That didn't work. I'm not supposed to enter a connection string
    >>>> like that in the aspnet_regsql tool.
    >>>>
    >>>> "Peter Bromberg [C# MVP]" wrote:
    >>>>
    >>>>> try connectionstrings.com.
    >>>>> a typical connection string (simplified version):
    >>>>> "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    >>>>> --
    >>>>> Co-founder, Eggheadcafe.com developer portal:
    >>>>> http://www.eggheadcafe.com
    >>>>> UnBlog:
    >>>>> http://petesbloggerama.blogspot.com
    >>>>> "Amit" wrote:
    >>>>>> I still can't get .net 2.0 to connect to sql server 2000 instance.
    >>>>>>
    >>>>>> I opened another application in vs 2003 and the remote connection
    >>>>>> worked fine so I don't think its the database or wireless
    >>>>>> connection. There must be some setting in .net 2.0 thats
    >>>>>> different. Is there a different way to write the connection
    >>>>>> string? Please somebody help. I'm at a loss. The database is
    >>>>>> configured with the following values, where the columns are
    >>>>>> minimum, maximum, config value, and run value. As you can see
    >>>>>> remote access is enabled, the login timeout is set at 2000
    >>>>>> seconds, and remote query timeout is set at infinite.
    >>>>>>
    >>>>>> remote access 0 1 1 1
    >>>>>> remote login timeout (s) 0 2147483647 2000 2000
    >>>>>> remote proc trans 0 1 0 0
    >>>>>> remote query timeout (s) 0 2147483647 0 0
    >>>>>> I'm running out of variables to test.
    >>>>>> "Amit" wrote:
    >>>>>>
    >>>>>>> Well, its definitely not anything to do with a query. I'm
    >>>>>>> assuming I should be able to get the aspnet_regsql.exe tool to
    >>>>>>> connect to the database, which I cannot. Is there a way to set
    >>>>>>> the timeout of the aspnet_regsql tool or should I try to change
    >>>>>>> the timeout of sqlserver?
    >>>>>>>
    >>>>>>> Why would an error like this even happen?
    >>>>>>>

    >
    >
     
    Gabriel Lozano-Morán, Dec 9, 2006
    #8
  9. Thanks Gabe! Injecting the timeout in the server name did the trick. I
    didn't even know you could do that....I guess I didn't realize that the
    aspnet_regsql is still building the connection string just like a regular
    application. Granted, I'm not happy that I have to add a longer timeout but
    I'm guessing I won't have this problem when I go put deploy my site to
    production.

    Thanks!

    "Gabriel Lozano-Morán" wrote:

    > Hello Amit,
    >
    > You should try a small .NET 2.0 console application that connects to the
    > SQL Server 2000 using the following connection string to check if that works:
    >
    > If you are using a trusted connection:
    > server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;
    >
    > Otherwise:
    > server=SERVER;UID=userid;PWD=password;
    >
    > using System.Data.SqlClient;
    >
    > namespace ConsoleApplication1
    > {
    > internal class Program
    > {
    > private static void Main(string[] args)
    > {
    > string connectionString = "server=SERVER;Trusted_Connection=true;UID=userid;PWD=password;";
    > using (SqlConnection connection = new SqlConnection(connectionString))
    > {
    > connection.Open();
    > }
    > }
    > }
    > }
    >
    > Gabriel Lozano-Morán
    > The .NET Aficionado
    > http://www.pointerx.net
    >
    >
    >
    > > That didn't work. I'm not supposed to enter a connection string like
    > > that in the aspnet_regsql tool.
    > >
    > > "Peter Bromberg [C# MVP]" wrote:
    > >
    > >> try connectionstrings.com.
    > >> a typical connection string (simplified version):
    > >> "server=192.168.10.103;database=mydatabase;uid=sa;pwd=blah";
    > >> --
    > >> Co-founder, Eggheadcafe.com developer portal:
    > >> http://www.eggheadcafe.com
    > >> UnBlog:
    > >> http://petesbloggerama.blogspot.com
    > >> "Amit" wrote:
    > >>
    > >>> I still can't get .net 2.0 to connect to sql server 2000 instance.
    > >>>
    > >>> I opened another application in vs 2003 and the remote connection
    > >>> worked fine so I don't think its the database or wireless
    > >>> connection. There must be some setting in .net 2.0 thats different.
    > >>> Is there a different way to write the connection string? Please
    > >>> somebody help. I'm at a loss. The database is configured with the
    > >>> following values, where the columns are minimum, maximum, config
    > >>> value, and run value. As you can see remote access is enabled, the
    > >>> login timeout is set at 2000 seconds, and remote query timeout is
    > >>> set at infinite.
    > >>>
    > >>> remote access 0 1 1 1
    > >>> remote login timeout (s) 0 2147483647 2000 2000
    > >>> remote proc trans 0 1 0 0
    > >>> remote query timeout (s) 0 2147483647 0 0
    > >>> I'm running out of variables to test.
    > >>>
    > >>> "Amit" wrote:
    > >>>
    > >>>> Well, its definitely not anything to do with a query. I'm assuming
    > >>>> I should be able to get the aspnet_regsql.exe tool to connect to
    > >>>> the database, which I cannot. Is there a way to set the timeout of
    > >>>> the aspnet_regsql tool or should I try to change the timeout of
    > >>>> sqlserver?
    > >>>>
    > >>>> Why would an error like this even happen?
    > >>>>
    > >>>> "Peter Bromberg [C# MVP]" wrote:
    > >>>>
    > >>>>> You have two potential Timeouts to deal with:
    > >>>>>
    > >>>>> The ADO.NET SqlCommand has a CommandTimeout property. And the
    > >>>>> SqlConnection
    > >>>>> has a timeout property. Your command can timeout on a long running
    > >>>>> query and
    > >>>>> that has nothing to do with your connection.
    > >>>>> Hope that helps.
    > >>>>> Peter
    > >>>>> --
    > >>>>> Co-founder, Eggheadcafe.com developer portal:
    > >>>>> http://www.eggheadcafe.com
    > >>>>> UnBlog:
    > >>>>> http://petesbloggerama.blogspot.com
    > >>>>> "Amit" wrote:
    > >>>>>
    > >>>>>> How do you increase the SQL Server timeout? Is it the login
    > >>>>>> timeout or transaction timeout I should increase? I guess I'm
    > >>>>>> confused on why one application that I upgraded to asp.net2.0
    > >>>>>> works (although I had to increase the timeout in the connection
    > >>>>>> string) while everything else seems to timeout.
    > >>>>>>
    > >>>>>> "Peter Bromberg [C# MVP]" wrote:
    > >>>>>>
    > >>>>>>> For SQL Server 2000, In Enterprise Manager, right click the
    > >>>>>>> Database in the Left pane, and choose properties.
    > >>>>>>>
    > >>>>>>> In the Security tab, you need "Sql Server and Windows" radio. In
    > >>>>>>> the Connection Tab, you need "Allow other SQL Servers..." if you
    > >>>>>>> have other Databases that need to connect to it.
    > >>>>>>>
    > >>>>>>> Peter
    > >>>>>>>
    > >>>>>>> --
    > >>>>>>> Co-founder, Eggheadcafe.com developer portal:
    > >>>>>>> http://www.eggheadcafe.com
    > >>>>>>> UnBlog:
    > >>>>>>> http://petesbloggerama.blogspot.com
    > >>>>>>> "Amit" wrote:
    > >>>>>>>
    > >>>>>>>> How do I check if SQL allows remote connections and has mixed
    > >>>>>>>> mode authentication? I checked the "remote login timeout" for
    > >>>>>>>> SQL server and its set at 2000. Is this the setting you're
    > >>>>>>>> referring to?
    > >>>>>>>>
    > >>>>>>>> I can run another web application in .net 2.0 fine when I
    > >>>>>>>> explicitly set the connect timeout setting to 2000 in the
    > >>>>>>>> connection string.
    > >>>>>>>>
    > >>>>>>>> "Peter Bromberg [C# MVP]" wrote:
    > >>>>>>>>
    > >>>>>>>>> Make sure your SQL Server is allowing remote connections and
    > >>>>>>>>> has mixed mode
    > >>>>>>>>> (Windows and SQL Server) authentication enabled. Make a page
    > >>>>>>>>> with nothing but
    > >>>>>>>>> a a sample connection and try / catch so you can output the
    > >>>>>>>>> result of any
    > >>>>>>>>> exception Message and stacktrace.
    > >>>>>>>>> Peter
    > >>>>>>>>> --
    > >>>>>>>>> Co-founder, Eggheadcafe.com developer portal:
    > >>>>>>>>> http://www.eggheadcafe.com
    > >>>>>>>>> UnBlog:
    > >>>>>>>>> http://petesbloggerama.blogspot.com

    >
    >
    >
     
    =?Utf-8?B?QW1pdA==?=, Dec 9, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Eyles

    SQL timeout error

    Martin Eyles, Jul 31, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    59,855
    yumil
    Oct 6, 2011
  2. dave
    Replies:
    2
    Views:
    1,938
    daveh551
    Dec 4, 2008
  3. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,290
    Brian Candler
    Oct 6, 2004
  4. vishnu
    Replies:
    0
    Views:
    363
    vishnu
    May 31, 2006
  5. vishnu
    Replies:
    0
    Views:
    206
    vishnu
    May 31, 2006
Loading...

Share This Page