Showing posts with label opening. Show all posts
Showing posts with label opening. Show all posts

Monday, March 19, 2012

Connectiong to SQL Server 2000 over VPN

Hi, hoping someone can help me out here. I am opening enterprise manager and trying to register a new server for which I have permissions. When I use windows authentication I get "Login Failed for user "(null)" and when I use SQL Server Authentication I get "Login failed for user "sa".

I am VPN'd in to the companies network. I am not on their domain, I am on a domain at my current location. I think the problem is that I am not logged on to their domain therefore it can't see me as the user I am on that domain. Is there any way to trick this, or simply to get it to work?

Thanks in advance.Can you reach the server on the VPN (ping it) ?
if not, you need to reconfigurate your network settings(IP of the switch connectiong to the VPN)
if you can ping it, you should have no problem using SQL server Authentication (unless firewall filter the SQL Server port)

Originally posted by kevin86
Hi, hoping someone can help me out here. I am opening enterprise manager and trying to register a new server for which I have permissions. When I use windows authentication I get "Login Failed for user "(null)" and when I use SQL Server Authentication I get "Login failed for user "sa".

I am VPN'd in to the companies network. I am not on their domain, I am on a domain at my current location. I think the problem is that I am not logged on to their domain therefore it can't see me as the user I am on that domain. Is there any way to trick this, or simply to get it to work?

Thanks in advance.|||I can ping the server. I can also access shared folders on this server. When I use SQL Authentication I have tried using SA, our Admin account, and an account set up for me and they all say login failed for user.

How could I check to see if the firewall is blocking it? I don't think this is the problem but I guess it could be?|||I think you have to ask to the system admin for the firewall.

Do you asked someone on the domain (not using the VPN) to try login SQL server with the same users you tried ?

Originally posted by kevin86
I can ping the server. I can also access shared folders on this server. When I use SQL Authentication I have tried using SA, our Admin account, and an account set up for me and they all say login failed for user.

How could I check to see if the firewall is blocking it? I don't think this is the problem but I guess it could be?|||Someone on the domain was able to log in using the id's I tried.

I just spoke to our network admin and these ports are not blocked. Any other suggestions?|||Originally posted by kevin86
Someone on the domain was able to log in using the id's I tried.

I just spoke to our network admin and these ports are not blocked. Any other suggestions?

You cannot register as windows nt user (trusted) cos you might not be added to that server as a user, and as you are able to ping the server , you are suppose to register the server using sql login, the only reason i would say you are not able to register is the sa password is wrong, try overwriting the password froom any of the machines where its already connected and then register it ...you should be able to connect ...

Sunday, March 11, 2012

Connection.CommandTimeout

Running VB6 with SQL Server 7, opening a connection and setting this
parameter by Conn.CommandTimeout does not always seem to force a
command (stored procedure) executed through Conn.Execute to timeout
after the specified period. Is anybody able to suggest what may be
going on here.

Thankspeter.dawson@.kingsch.nhs.uk (Petros) wrote in message news:<478ba33e.0309300533.2e31f9f7@.posting.google.com>...
> Running VB6 with SQL Server 7, opening a connection and setting this
> parameter by Conn.CommandTimeout does not always seem to force a
> command (stored procedure) executed through Conn.Execute to timeout
> after the specified period. Is anybody able to suggest what may be
> going on here.
> Thanks

CommandTimeout starts when the database server has accepted the
command and ends when the database server returns the first record. If
the server or network is busy (or not answering at all), this setting
won't help you to get control again.|||Petros (peter.dawson@.kingsch.nhs.uk) writes:
> Running VB6 with SQL Server 7, opening a connection and setting this
> parameter by Conn.CommandTimeout does not always seem to force a
> command (stored procedure) executed through Conn.Execute to timeout
> after the specified period. Is anybody able to suggest what may be
> going on here.

If you are also running queries from the command object, you need
to see the .CommandTimeout for that object too; the value is not
inherited from the connection object.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 7, 2012

Connection timeout when using transactions

I'm getting a timeout error while trying to select data from SQL server
2005 after opening a transaction in asn asp.net application.
It goes like this:
SqlConnection conn1 = new SqlConnection(...);
conn1.Open();
SqlTransaction trans = conn1.Open();
// do some inserts and updates using the transaction
SqlConnection conn2 = new SqlConnection(...);
conn2.Open();
// select using conn2 and decide what to do
conn2.Close();
// do more inserts and updates based on that decision
trans.Commit();
conn1.Commit();
It probably has something to do with the connection pool returning the
already open conn1 to connection2.
In the actual process, the select using the 2nd connection is being
opened in another method, and I don't want to overload the method to
receive the transaction.
Is there any other option? Is there any way to really open another
connection, or the connection pool to not return open connections being
used in transactions?
Thanks.Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
> Thanks.
Have you changed the default CommandTimeout from the default? I think
the default for ASP/ASP.NET is 30 seconds.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy McKibben wrote:
> Have you changed the default CommandTimeout from the default? I think
> the default for ASP/ASP.NET is 30 seconds.
No, and it is not the problem. The whole process takes less than 1 second.
The thing is exactly what I told. If I open an second connection and
select something, while connection one is in transaction, it hangs and
gives me a connection timeout.
Can anyone reproduce this?|||Natan Vivo wrote:
> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I think
>> the default for ASP/ASP.NET is 30 seconds.
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Not knowing what selects you're running in connection 2, I'd have to say
you're probably deadlocking against the open transaction in connection 1.
http://realsqlguy.com/twiki/bin/view/RealSQLGuy/SimulatingADeadlock
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Natan Vivo wrote:
> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I think
>> the default for ASP/ASP.NET is 30 seconds.
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Yes, I had the exact same problem in an application of mine. In the
absence of finding a solution, I coded around it. Sorry I can't be of
more help, but you're not alone. :)
Neil B|||Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
>
No, that's not how the connection pool works. If you have two open
connections in your code, you'll be using two connections from the
connection pool.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
>From your description, it's almost certainly a deadlock on sql server.
Without seeing the database code, it's going to be difficult to help
you out.
To confirm it's a deadlock, open a connection using query analyser,
start your code running, then run sp_who2. It'll show your second
connection being blocked by your first.
Damien|||Tracy McKibben wrote:
> Natan Vivo wrote:
>> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I
>> think the default for ASP/ASP.NET is 30 seconds.
>> No, and it is not the problem. The whole process takes less than 1
>> second.
>> The thing is exactly what I told. If I open an second connection and
>> select something, while connection one is in transaction, it hangs and
>> gives me a connection timeout.
>> Can anyone reproduce this?
> Not knowing what selects you're running in connection 2, I'd have to say
> you're probably deadlocking against the open transaction in connection 1.
> http://realsqlguy.com/twiki/bin/view/RealSQLGuy/SimulatingADeadlock
>
Thanks. It was really a deadlock, the select was selecting data from the
same table I had already update.
It seems I can solve this by using the right IsolationLevel when
begining the transaction.
I'll test it later. Thanks!|||Natan Vivo wrote:
> Thanks. It was really a deadlock, the select was selecting data from the
> same table I had already update.
> It seems I can solve this by using the right IsolationLevel when
> begining the transaction.
> I'll test it later. Thanks!
Be careful that you're not reading "dirty" data, meaning data that is
inconsistent because it's been partially altered by a transaction...
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Connection timeout when using transactions

I'm getting a timeout error while trying to select data from SQL server
2005 after opening a transaction in asn asp.net application.
It goes like this:
SqlConnection conn1 = new SqlConnection(...);
conn1.Open();
SqlTransaction trans = conn1.Open();
// do some inserts and updates using the transaction
SqlConnection conn2 = new SqlConnection(...);
conn2.Open();
// select using conn2 and decide what to do
conn2.Close();
// do more inserts and updates based on that decision
trans.Commit();
conn1.Commit();
It probably has something to do with the connection pool returning the
already open conn1 to connection2.
In the actual process, the select using the 2nd connection is being
opened in another method, and I don't want to overload the method to
receive the transaction.
Is there any other option? Is there any way to really open another
connection, or the connection pool to not return open connections being
used in transactions?
Thanks.Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
> Thanks.
Have you changed the default CommandTimeout from the default? I think
the default for ASP/ASP.NET is 30 seconds.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy McKibben wrote:
> Have you changed the default CommandTimeout from the default? I think
> the default for ASP/ASP.NET is 30 seconds.
No, and it is not the problem. The whole process takes less than 1 second.
The thing is exactly what I told. If I open an second connection and
select something, while connection one is in transaction, it hangs and
gives me a connection timeout.
Can anyone reproduce this?|||Natan Vivo wrote:
> Tracy McKibben wrote:
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Not knowing what selects you're running in connection 2, I'd have to say
you're probably deadlocking against the open transaction in connection 1.
http://realsqlguy.com/twiki/bin/vie...latingADeadlock
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Natan Vivo wrote:
> Tracy McKibben wrote:
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Yes, I had the exact same problem in an application of mine. In the
absence of finding a solution, I coded around it. Sorry I can't be of
more help, but you're not alone.
Neil B|||Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
>
No, that's not how the connection pool works. If you have two open
connections in your code, you'll be using two connections from the
connection pool.

> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
>From your description, it's almost certainly a deadlock on sql server.
Without seeing the database code, it's going to be difficult to help
you out.
To confirm it's a deadlock, open a connection using query analyser,
start your code running, then run sp_who2. It'll show your second
connection being blocked by your first.
Damien|||Tracy McKibben wrote:
> Natan Vivo wrote:
> Not knowing what selects you're running in connection 2, I'd have to say
> you're probably deadlocking against the open transaction in connection 1.
> http://realsqlguy.com/twiki/bin/vie...latingADeadlock
>
Thanks. It was really a deadlock, the select was selecting data from the
same table I had already update.
It seems I can solve this by using the right IsolationLevel when
begining the transaction.
I'll test it later. Thanks!|||Natan Vivo wrote:
> Thanks. It was really a deadlock, the select was selecting data from the
> same table I had already update.
> It seems I can solve this by using the right IsolationLevel when
> begining the transaction.
> I'll test it later. Thanks!
Be careful that you're not reading "dirty" data, meaning data that is
inconsistent because it's been partially altered by a transaction...
Tracy McKibben
MCDBA
http://www.realsqlguy.com