Showing posts with label computer. Show all posts
Showing posts with label computer. Show all posts

Thursday, March 8, 2012

An error has occurred on the computer running IIS

Hi, i was following the tutorial in SQL Mobile Books online "Creating a Mobile Application with SQL Server Mobile ", but when i try to run the application using the pocket PC 2003 emulator, the got the following error, "An error has occurred on the computer running IIS, Try restarting the IIS server.", any idea why?

Check to see if the IIS URL is missing double quotes in your application. Compare with an example in Books Online.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Check to see if the IIS URL is missing double quotes.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

thanks for your reply Syed..

I have checked the IIS URL and it has double quotes. one thing my application is different from the tutorial sample is, on the tutorial

repl.PublisherSecurityMode = SecurityType.NTAuthentication;

but in my application,

repl.PublisherSecurityMode = SecurityType.DBAuthentication;

repl.PublisherLogin = @."sa";

repl.PublisherPassword = @."<admin1234admin>";

repl.Publication = @."SQLMobile";

repl.Subscriber = @."SQLMobile";

repl.SubscriberConnectionString = @."Data Source='" + filename + "';Password='';Max Database Size='128';Default Lock Escalation ='100';";

because i am using SQL Server Authentication rather than DBAuthentication used in the sample. would this have made the impact?

|||

Check to see if Pocket IE on the emulator is able to browse the IIS URL. Also you may want to generate a server agent log on IIS as described in

SQL Server 2005 Mobile Edition Books Online topic :"Enabling Logging by Using SQL Server Mobile Server Agent."

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Hi Syed,

I followed the tutorial, couldn't connect to IIS URL from the emulator. I am testing this on my standalone PC with local IIS. Can you suggest me what needs to be checked.

Regards

Aravind

|||

Dear FeiH,

I also have the same error as u already faced, like An error has occurred on the computer running IIS , could u solve this pbm, then pls give a good suggestion, pls help me.

|||

sorry Jeyaseelan,

whatever i've tried didn't work for me and I haven't investigated on it since.

|||How are you connecting to the IIS machine, are you using anonymous authentication or basic/integrated authentication.|||

hi , Udaya

This error happens when the device is not able to get conne ted with the IIS. Before running the program just open IE and try browsing some websites. If that is ok , try entering the SQL CE Server agent URL .

If you are using the RDA tutorial , the link will be something like :

http://121.247.150.xxx/yourvirtuladirectory/sqlcesa30.dll

If your IIS is configured properly you can see a simple webpage with a text message

SQL Server Mobile Server Agent 3.0 .

|||

Hi Every Body

I have been having a tough time with Configuring IIS.

My IIS is Configured Properly and it Shows the Text Message on the URl

"SQL Server Mobile Server Agent 3.0"

But Still in the Every Last Step it says "Unable To Connect to Computer Running IIS".

Me Using My Local Machine.

- I have Tried Using Anonyous Acess.

- Tried to user the IUSR_[MAchineName]

But None Worked for me.

IF any one can Help.

Regards

Adnan.

|||

Hi ,

Do not worry , U cam correct it!!

In fact u do not have to stick to all the steps in e book.

Regarding IIS configuration u can perfiorm many other steps.

If I start explaining , it may take many pages. The best thing u can do in this regard is watch this video.

http://channel9.msdn.com/Showpost.aspx?postid=209464

Are u trying to run this in a pocket PC/mobile device.?

f yes, make sure it is connected to INternet.

Either through Active Sync or through GPRS.

-Aneesh

An error has occurred on the computer running IIS

Hello All,

I'm developing pocket PC application.. when I want to replicate my data from pocket pc to development pc.. I've got this error on my pocket pc.. "An error has occurred on the computer running IIS"

Any ideas? Any help?

I'm using SQl Server 2000, SQL Server CE 2.0, VS.Net 2003

Thanks

I am sure get more than 5 hits for this error on this forum. Let me not repeat the stories, please try out the solutions previously posted.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Ev, Microsoft Corporation

|||try to set it up according to this step-by-step guide:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

greets
florian

An error has occurred on the computer running IIS

Hi, i was following the tutorial in SQL Mobile Books online "Creating a Mobile Application with SQL Server Mobile ", but when i try to run the application using the pocket PC 2003 emulator, the got the following error, "An error has occurred on the computer running IIS, Try restarting the IIS server.", any idea why?

Check to see if the IIS URL is missing double quotes in your application. Compare with an example in Books Online.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Check to see if the IIS URL is missing double quotes.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

thanks for your reply Syed..

I have checked the IIS URL and it has double quotes. one thing my application is different from the tutorial sample is, on the tutorial

repl.PublisherSecurityMode = SecurityType.NTAuthentication;

but in my application,

repl.PublisherSecurityMode = SecurityType.DBAuthentication;

repl.PublisherLogin = @."sa";

repl.PublisherPassword = @."<admin1234admin>";

repl.Publication = @."SQLMobile";

repl.Subscriber = @."SQLMobile";

repl.SubscriberConnectionString = @."Data Source='" + filename + "';Password='';Max Database Size='128';Default Lock Escalation ='100';";

because i am using SQL Server Authentication rather than DBAuthentication used in the sample. would this have made the impact?

|||

Check to see if Pocket IE on the emulator is able to browse the IIS URL. Also you may want to generate a server agent log on IIS as described in

SQL Server 2005 Mobile Edition Books Online topic :"Enabling Logging by Using SQL Server Mobile Server Agent."

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Hi Syed,

I followed the tutorial, couldn't connect to IIS URL from the emulator. I am testing this on my standalone PC with local IIS. Can you suggest me what needs to be checked.

Regards

Aravind

|||

Dear FeiH,

I also have the same error as u already faced, like An error has occurred on the computer running IIS , could u solve this pbm, then pls give a good suggestion, pls help me.

|||

sorry Jeyaseelan,

whatever i've tried didn't work for me and I haven't investigated on it since.

|||How are you connecting to the IIS machine, are you using anonymous authentication or basic/integrated authentication.|||

hi , Udaya

This error happens when the device is not able to get conne ted with the IIS. Before running the program just open IE and try browsing some websites. If that is ok , try entering the SQL CE Server agent URL .

If you are using the RDA tutorial , the link will be something like :

http://121.247.150.xxx/yourvirtuladirectory/sqlcesa30.dll

If your IIS is configured properly you can see a simple webpage with a text message

SQL Server Mobile Server Agent 3.0 .

|||

Hi Every Body

I have been having a tough time with Configuring IIS.

My IIS is Configured Properly and it Shows the Text Message on the URl

"SQL Server Mobile Server Agent 3.0"

But Still in the Every Last Step it says "Unable To Connect to Computer Running IIS".

Me Using My Local Machine.

- I have Tried Using Anonyous Acess.

- Tried to user the IUSR_[MAchineName]

But None Worked for me.

IF any one can Help.

Regards

Adnan.

|||

Hi ,

Do not worry , U cam correct it!!

In fact u do not have to stick to all the steps in e book.

Regarding IIS configuration u can perfiorm many other steps.

If I start explaining , it may take many pages. The best thing u can do in this regard is watch this video.

http://channel9.msdn.com/Showpost.aspx?postid=209464

Are u trying to run this in a pocket PC/mobile device.?

f yes, make sure it is connected to INternet.

Either through Active Sync or through GPRS.

-Aneesh

An error has occurred on the computer running IIS

Hi, i was following the tutorial in SQL Mobile Books online "Creating a Mobile Application with SQL Server Mobile ", but when i try to run the application using the pocket PC 2003 emulator, the got the following error, "An error has occurred on the computer running IIS, Try restarting the IIS server.", any idea why?

Check to see if the IIS URL is missing double quotes in your application. Compare with an example in Books Online.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Check to see if the IIS URL is missing double quotes.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

thanks for your reply Syed..

I have checked the IIS URL and it has double quotes. one thing my application is different from the tutorial sample is, on the tutorial

repl.PublisherSecurityMode = SecurityType.NTAuthentication;

but in my application,

repl.PublisherSecurityMode = SecurityType.DBAuthentication;

repl.PublisherLogin = @."sa";

repl.PublisherPassword = @."<admin1234admin>";

repl.Publication = @."SQLMobile";

repl.Subscriber = @."SQLMobile";

repl.SubscriberConnectionString = @."Data Source='" + filename + "';Password='';Max Database Size='128';Default Lock Escalation ='100';";

because i am using SQL Server Authentication rather than DBAuthentication used in the sample. would this have made the impact?

|||

Check to see if Pocket IE on the emulator is able to browse the IIS URL. Also you may want to generate a server agent log on IIS as described in

SQL Server 2005 Mobile Edition Books Online topic :"Enabling Logging by Using SQL Server Mobile Server Agent."

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Hi Syed,

I followed the tutorial, couldn't connect to IIS URL from the emulator. I am testing this on my standalone PC with local IIS. Can you suggest me what needs to be checked.

Regards

Aravind

|||

Dear FeiH,

I also have the same error as u already faced, like An error has occurred on the computer running IIS , could u solve this pbm, then pls give a good suggestion, pls help me.

|||

sorry Jeyaseelan,

whatever i've tried didn't work for me and I haven't investigated on it since.

|||How are you connecting to the IIS machine, are you using anonymous authentication or basic/integrated authentication.|||

hi , Udaya

This error happens when the device is not able to get conne ted with the IIS. Before running the program just open IE and try browsing some websites. If that is ok , try entering the SQL CE Server agent URL .

If you are using the RDA tutorial , the link will be something like :

http://121.247.150.xxx/yourvirtuladirectory/sqlcesa30.dll

If your IIS is configured properly you can see a simple webpage with a text message

SQL Server Mobile Server Agent 3.0 .

|||

Hi Every Body

I have been having a tough time with Configuring IIS.

My IIS is Configured Properly and it Shows the Text Message on the URl

"SQL Server Mobile Server Agent 3.0"

But Still in the Every Last Step it says "Unable To Connect to Computer Running IIS".

Me Using My Local Machine.

- I have Tried Using Anonyous Acess.

- Tried to user the IUSR_[MAchineName]

But None Worked for me.

IF any one can Help.

Regards

Adnan.

|||

Hi ,

Do not worry , U cam correct it!!

In fact u do not have to stick to all the steps in e book.

Regarding IIS configuration u can perfiorm many other steps.

If I start explaining , it may take many pages. The best thing u can do in this regard is watch this video.

http://channel9.msdn.com/Showpost.aspx?postid=209464

Are u trying to run this in a pocket PC/mobile device.?

f yes, make sure it is connected to INternet.

Either through Active Sync or through GPRS.

-Aneesh

An error has occurred on the computer running IIS

Hi, i was following the tutorial in SQL Mobile Books online "Creating a Mobile Application with SQL Server Mobile ", but when i try to run the application using the pocket PC 2003 emulator, the got the following error, "An error has occurred on the computer running IIS, Try restarting the IIS server.", any idea why?

Check to see if the IIS URL is missing double quotes in your application. Compare with an example in Books Online.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Check to see if the IIS URL is missing double quotes.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

thanks for your reply Syed..

I have checked the IIS URL and it has double quotes. one thing my application is different from the tutorial sample is, on the tutorial

repl.PublisherSecurityMode = SecurityType.NTAuthentication;

but in my application,

repl.PublisherSecurityMode = SecurityType.DBAuthentication;

repl.PublisherLogin = @."sa";

repl.PublisherPassword = @."<admin1234admin>";

repl.Publication = @."SQLMobile";

repl.Subscriber = @."SQLMobile";

repl.SubscriberConnectionString = @."Data Source='" + filename + "';Password='';Max Database Size='128';Default Lock Escalation ='100';";

because i am using SQL Server Authentication rather than DBAuthentication used in the sample. would this have made the impact?

|||

Check to see if Pocket IE on the emulator is able to browse the IIS URL. Also you may want to generate a server agent log on IIS as described in

SQL Server 2005 Mobile Edition Books Online topic :"Enabling Logging by Using SQL Server Mobile Server Agent."

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

|||

Hi Syed,

I followed the tutorial, couldn't connect to IIS URL from the emulator. I am testing this on my standalone PC with local IIS. Can you suggest me what needs to be checked.

Regards

Aravind

|||

Dear FeiH,

I also have the same error as u already faced, like An error has occurred on the computer running IIS , could u solve this pbm, then pls give a good suggestion, pls help me.

|||

sorry Jeyaseelan,

whatever i've tried didn't work for me and I haven't investigated on it since.

|||How are you connecting to the IIS machine, are you using anonymous authentication or basic/integrated authentication.|||

hi , Udaya

This error happens when the device is not able to get conne ted with the IIS. Before running the program just open IE and try browsing some websites. If that is ok , try entering the SQL CE Server agent URL .

If you are using the RDA tutorial , the link will be something like :

http://121.247.150.xxx/yourvirtuladirectory/sqlcesa30.dll

If your IIS is configured properly you can see a simple webpage with a text message

SQL Server Mobile Server Agent 3.0 .

|||

Hi Every Body

I have been having a tough time with Configuring IIS.

My IIS is Configured Properly and it Shows the Text Message on the URl

"SQL Server Mobile Server Agent 3.0"

But Still in the Every Last Step it says "Unable To Connect to Computer Running IIS".

Me Using My Local Machine.

- I have Tried Using Anonyous Acess.

- Tried to user the IUSR_[MAchineName]

But None Worked for me.

IF any one can Help.

Regards

Adnan.

|||

Hi ,

Do not worry , U cam correct it!!

In fact u do not have to stick to all the steps in e book.

Regarding IIS configuration u can perfiorm many other steps.

If I start explaining , it may take many pages. The best thing u can do in this regard is watch this video.

http://channel9.msdn.com/Showpost.aspx?postid=209464

Are u trying to run this in a pocket PC/mobile device.?

f yes, make sure it is connected to INternet.

Either through Active Sync or through GPRS.

-Aneesh

Saturday, February 25, 2012

An additional SQL 2005 instance - How much extra resources does it consume ?

Dear all,
In order to migrate my existing SQL 2000 databases to SQL 2005, I want to
install an additional SQL 2005 instance, how much extra computer resources,
eg. CPU, memory, ... will it consume ?
Do you have any ideal ?
Or where can I get this information ?
Please tell me if you know, thanks a lot.It depends on how much heavily you are gonna use it. I can at least say
that, every connection to SQL Server 2005 will consume 28KB if I'm
remembering correctly :)
Other stuff is environment-specific. How densely you use your databases,
your queries...
--
Ekrem Önsoy
"cpchan" <cpchaney@.netvigator.com> wrote in message
news:470a4545$1@.127.0.0.1...
> Dear all,
> In order to migrate my existing SQL 2000 databases to SQL 2005, I want to
> install an additional SQL 2005 instance, how much extra computer
> resources,
> eg. CPU, memory, ... will it consume ?
> Do you have any ideal ?
> Or where can I get this information ?
> Please tell me if you know, thanks a lot.
>|||Thanks, I will migrate my SQL 2000 databases to this additional SQL 2005
instance one by one, so you can see, there will be no change either in the
total no. of databases or database work load.
However, people can still agrue that the server has one more SQL 2005
instance, it might consume a certain amount of resources, so, I have to know
how much resources will the SQL 2005 instance consume.
Or where can I get this information ?
Please tell me if you know.
"Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
news:795C55B8-B3D7-4134-8023-9C411C74E363@.microsoft.com...
> It depends on how much heavily you are gonna use it. I can at least say
> that, every connection to SQL Server 2005 will consume 28KB if I'm
> remembering correctly :)
> Other stuff is environment-specific. How densely you use your databases,
> your queries...
> --
> Ekrem Önsoy
>
> "cpchan" <cpchaney@.netvigator.com> wrote in message
> news:470a4545$1@.127.0.0.1...
> > Dear all,
> >
> > In order to migrate my existing SQL 2000 databases to SQL 2005, I want
to
> > install an additional SQL 2005 instance, how much extra computer
> > resources,
> > eg. CPU, memory, ... will it consume ?
> >
> > Do you have any ideal ?
> > Or where can I get this information ?
> >
> > Please tell me if you know, thanks a lot.
> >
> >
>|||It is impossible to say. You are in the best position to answer that if you
are migrating existing dbs on the same server you should have an idea
already. Two instances will always use more resources than a single instance
but how it breaks down will be different depends on many factors, none of
which we know anything about. Can't you just upgrade the 2000 instance to
2005 and keep the dbs that require it in 80 compatibility mode?
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"cpchan" <cpchaney@.netvigator.com> wrote in message
news:470a515c$1@.127.0.0.1...
> Thanks, I will migrate my SQL 2000 databases to this additional SQL 2005
> instance one by one, so you can see, there will be no change either in the
> total no. of databases or database work load.
> However, people can still agrue that the server has one more SQL 2005
> instance, it might consume a certain amount of resources, so, I have to
> know
> how much resources will the SQL 2005 instance consume.
> Or where can I get this information ?
> Please tell me if you know.
> "Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
> news:795C55B8-B3D7-4134-8023-9C411C74E363@.microsoft.com...
>> It depends on how much heavily you are gonna use it. I can at least say
>> that, every connection to SQL Server 2005 will consume 28KB if I'm
>> remembering correctly :)
>> Other stuff is environment-specific. How densely you use your databases,
>> your queries...
>> --
>> Ekrem Önsoy
>>
>> "cpchan" <cpchaney@.netvigator.com> wrote in message
>> news:470a4545$1@.127.0.0.1...
>> > Dear all,
>> >
>> > In order to migrate my existing SQL 2000 databases to SQL 2005, I want
> to
>> > install an additional SQL 2005 instance, how much extra computer
>> > resources,
>> > eg. CPU, memory, ... will it consume ?
>> >
>> > Do you have any ideal ?
>> > Or where can I get this information ?
>> >
>> > Please tell me if you know, thanks a lot.
>> >
>> >
>

Sunday, February 19, 2012

american idol cat fight topless = VIRUS

THE SCR file attempts to connect
to chit.badpenguin.net
to put a virus on your computer. - RM
Laurens Holst wrote:

> No. But .SCR files are *always* virii,
Surely you mean to qualify that with "posted" .SCR files? Windows
comes with plenty of valid .SCR files.

> just like .PIF files, .COM, .LNK,
> .VBS, etc. No-one meaning any good sends those files, really. .EXE's can
> be given the benefit of the doubt when they come from someone you know,
> but still be *very* wary and suspicous about it. ZIP files containing
> .EXE's: same story, also be very wary. I have received several virii
> like that (or perhaps it was just one and the same). Generally just
> don't execute anything executable you get by email, and *especially* not
> from usenet.
> Anyways, it's weird Norton didn't detect anything bad about it. Are you
> sure its virus definitions are up to date? Or it could be a new type of
> virus which Norton has not yet listed.
I have seen viruses that were not detected until the NEXT update!-)
Happily, I waited for the update (next day) to rescan same.
I have also seen an SCR type file that Norton did not ALARM until
the "screen saver" had downloaded the actual malware. This time I
was not interested in going the next step, just in raising the alarm.

> Be aware that even using an Antivirus doesn't make you 100% safe.
> Because what if I decided to make a virus, which is new to Norton so it
> won't detect it, and I spread it by making a mass mailing to the Usenet
> (say, with the topic "american idol cat fight topless").
I'm hoping you won't DO that!-) - RM

american idol cat fight topless = VIRUS

THE SCR file attempts to connect
to chit.badpenguin.net
to put a virus on your computer. - RMLaurens Holst wrote:

> No. But .SCR files are *always* virii,
Surely you mean to qualify that with "posted" .SCR files? Windows
comes with plenty of valid .SCR files.

> just like .PIF files, .COM, .LNK,
> .VBS, etc. No-one meaning any good sends those files, really. .EXE's can
> be given the benefit of the doubt when they come from someone you know,
> but still be *very* wary and suspicous about it. ZIP files containing
> .EXE's: same story, also be very wary. I have received several virii
> like that (or perhaps it was just one and the same). Generally just
> don't execute anything executable you get by email, and *especially* not
> from usenet.
> Anyways, it's weird Norton didn't detect anything bad about it. Are you
> sure its virus definitions are up to date? Or it could be a new type of
> virus which Norton has not yet listed.
I have seen viruses that were not detected until the NEXT update!-)
Happily, I waited for the update (next day) to rescan same.
I have also seen an SCR type file that Norton did not ALARM until
the "screen saver" had downloaded the actual malware. This time I
was not interested in going the next step, just in raising the alarm.

> Be aware that even using an Antivirus doesn't make you 100% safe.
> Because what if I decided to make a virus, which is new to Norton so it
> won't detect it, and I spread it by making a mass mailing to the Usenet
> (say, with the topic "american idol cat fight topless").
I'm hoping you won't DO that!-) - RM

Thursday, February 16, 2012

Am I physically connected to the server on the computer I am using

Hi All:

Is there a way to tell if I am connected to the server on the computer I am using to connect with?

I want to determine whether the connection is to the local server or a remote server.

Thanks.

Doug.

Doug,

The name of the server should appear in your 'Object Explorer' window. This will tell you whether you are connected to your local instance or a remote server.

Good Luck...

'Avarus animus nullo satiatur lucro - A greedy mind is satisfied with no (amount of) gain

|||

My fault, should have been more specific.

I am connecting to the server using ADO; is there any command, TSQL, etc that will let me know if the connection is to the local server?

|||

Execute the query (CommandText):

SELECT @.@.SERVERNAME

The return value will be the name of the Server you are connect with when the query is executed.

|||

Hi Arnie:

Perhaps I'm missing the point here... but would not that only give me the name of the local server, not the fact that I am actually sitting at the same workstation?

I did find another TSQL function called HOST_NAME() -- but I believe that returns the workstation name where the server resides, not the workstation I am sitting at?

So, I can get the host name and servername, but what I need is to know if there is a way to determine the I am physically at the workstation that hosts the server?

|||

I did some more testing.

I connected to a remote machine and the host_name() returned the workstation I was physically at, and the @.@.servername returned the name of the local server on the host machine (if there is no local server then it would return null, right?).

So it looks to me that those functions alone will not work, as I need to know if I was connected remotely (which was the case) and they did not seem to help.

Unless... what if I compared the DataSource of the connection string to the servername?

If the hostname = servername, and the datasource = servername, then I am connected locally?

Actually, now that I think about it... I don't even need hostname, but the servername.

If the datasource = servername, then I am connected locally, right?

|||

You are on the right track.

HOST_NAME() returns the client computer name.

@.@.SERVERNAME returns the SQL Server computer name/instance.

If the computer names don't match, the computers are different.

HOWEVER, the HOST_NAME() could be [MyComputer] and the @.@.SERVERNAME could be [MyComputer\SQLExpress] -a Named INSTANCE of SQL Server running on the computer [MyComputer]. So you would need to check for a backslash [\], and if present, use the portion of the @.@.SERVERNAME to the left of the backslash to compare with HOST_NAME().

DataSource = @.@.SERVERNAME 'should' always match. DataSource is the part of your connection string that directs the connection to a Server.

|||

Got it, thanks!

|||

Doug,

If you have Alerts on, then you will get this message.

I was half asleep. You can also use SERVERPROPERTY('MachineName') on the SQL Server. It will return the computer name without the Instance name -so you will NOT have to parse @.@.ServerName.

Just check

Code Snippet


IF host_name() <> serverproperty('machinename')
BEGIN
PRINT 'Remote Connection'
END
ELSE
BEGIN
PRINT 'Local Connection'
END

Am I physically connected to the server on the computer I am using

Hi All:

Is there a way to tell if I am connected to the server on the computer I am using to connect with?

I want to determine whether the connection is to the local server or a remote server.

Thanks.

Doug.

Doug,

The name of the server should appear in your 'Object Explorer' window. This will tell you whether you are connected to your local instance or a remote server.

Good Luck...

'Avarus animus nullo satiatur lucro - A greedy mind is satisfied with no (amount of) gain

|||

My fault, should have been more specific.

I am connecting to the server using ADO; is there any command, TSQL, etc that will let me know if the connection is to the local server?

|||

Execute the query (CommandText):

SELECT @.@.SERVERNAME

The return value will be the name of the Server you are connect with when the query is executed.

|||

Hi Arnie:

Perhaps I'm missing the point here... but would not that only give me the name of the local server, not the fact that I am actually sitting at the same workstation?

I did find another TSQL function called HOST_NAME() -- but I believe that returns the workstation name where the server resides, not the workstation I am sitting at?

So, I can get the host name and servername, but what I need is to know if there is a way to determine the I am physically at the workstation that hosts the server?

|||

I did some more testing.

I connected to a remote machine and the host_name() returned the workstation I was physically at, and the @.@.servername returned the name of the local server on the host machine (if there is no local server then it would return null, right?).

So it looks to me that those functions alone will not work, as I need to know if I was connected remotely (which was the case) and they did not seem to help.

Unless... what if I compared the DataSource of the connection string to the servername?

If the hostname = servername, and the datasource = servername, then I am connected locally?

Actually, now that I think about it... I don't even need hostname, but the servername.

If the datasource = servername, then I am connected locally, right?

|||

You are on the right track.

HOST_NAME() returns the client computer name.

@.@.SERVERNAME returns the SQL Server computer name/instance.

If the computer names don't match, the computers are different.

HOWEVER, the HOST_NAME() could be [MyComputer] and the @.@.SERVERNAME could be [MyComputer\SQLExpress] -a Named INSTANCE of SQL Server running on the computer [MyComputer]. So you would need to check for a backslash [\], and if present, use the portion of the @.@.SERVERNAME to the left of the backslash to compare with HOST_NAME().

DataSource = @.@.SERVERNAME 'should' always match. DataSource is the part of your connection string that directs the connection to a Server.

|||

Got it, thanks!

|||

Doug,

If you have Alerts on, then you will get this message.

I was half asleep. You can also use SERVERPROPERTY('MachineName') on the SQL Server. It will return the computer name without the Instance name -so you will NOT have to parse @.@.ServerName.

Just check

Code Snippet


IF host_name() <> serverproperty('machinename')
BEGIN
PRINT 'Remote Connection'
END
ELSE
BEGIN
PRINT 'Local Connection'
END