Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RE: SQL Timeout Error

Reply
Thread Tools

RE: SQL Timeout Error

 
 
=?Utf-8?B?QW1pdA==?=
Guest
Posts: n/a
 
      12-08-2006
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW1pdA==?=
Guest
Posts: n/a
 
      12-09-2006
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
> > > > > >

>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      12-09-2006
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
> > > > > > >

> >

 
Reply With Quote
 
=?Utf-8?B?QW1pdA==?=
Guest
Posts: n/a
 
      12-09-2006
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
> > > > > > > >
> > >

 
Reply With Quote
 
=?iso-8859-1?Q?Gabriel=20Lozano-Mor=e1n?=
Guest
Posts: n/a
 
      12-09-2006
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;P WD=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



 
Reply With Quote
 
=?Utf-8?B?QW1pdA==?=
Guest
Posts: n/a
 
      12-09-2006
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=RAINDL A;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=RAINDL A;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;P WD=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?
> >>>>

 
Reply With Quote
 
=?iso-8859-1?Q?Gabriel=20Lozano-Mor=e1n?=
Guest
Posts: n/a
 
      12-09-2006
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=RAINDL A;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=RAINDL A;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;P WD=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?
>>>>>>



 
Reply With Quote
 
Gabriel Lozano-MorŠn
Guest
Posts: n/a
 
      12-09-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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=RAINDL A;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=RAINDL A;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;P WD=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?
>>>>>>>

>
>



 
Reply With Quote
 
=?Utf-8?B?QW1pdA==?=
Guest
Posts: n/a
 
      12-09-2006
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;P WD=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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sql timeout from web application problem (works good in sql server dave ASP .Net 2 12-04-2008 02:42 PM
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
/usr/local/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error) vishnu Ruby 0 05-31-2006 11:08 AM
/usr/local/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error) vishnu Ruby 0 05-31-2006 11:08 AM
Timeout::timeout and Socket timeout Mark Probert Ruby 1 10-06-2004 09:30 AM



Advertisments