Showing posts with label window. Show all posts
Showing posts with label window. Show all posts

Wednesday, March 28, 2012

how to connect to sql server as other's window login rather than user's window login thorugh A

Dear members,

In MSDN, it says that it is recommended to use windows authentication to connect to SQL Server rather than use mixed authentication.

I create user delta\sqluser on windows OS, and I specify in my webform ASP.NET script below :

protected System.Web.UI.WebControls.Label Label1;
private string _connString = @."data source=delta\sql2000;initial catalog=northwind;integrated security=false;user id=delta\sqluser";
/*
comment : I login to my windows as delta\koronx, and I want to every user (including me), connected to sql server through IIS, will be identified as delta\sqluser not as user's login (impersonate)
*/
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection conn = new SqlConnection(_connString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select suser_sname()";

conn.Open();


string userName = cmd.ExecuteScalar() as string;
conn.Close();
conn.Close();
Label1.Text = userName;
}

at web.config, I add :
<identity impersonate="false" userName="delta\sqluser" password="" />

at IIS webApplication1's properties, tab "Directory Security", at "Authentication and access control" section, I checked "enable anonymous access" with user : DELTA\IUSR_DELTA and checked "Integrated Windows Authentication",

at query analyzer, I login as "sa" and execute script below :
exec sp_grantdbaccess 'delta\sqluser','northwind'

when I run the ASP.NET script, error at conn.Open(); with error message :
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

What should I do so that IIS login to SQL Server as user delta\sqluser not as "NT AUTHORITY\NETWORK SERVICE" ?

Regards,

Koronx

Your connection string is incorrect. You specify using SQL Authentication (integrated security = false) but what you want is integrated security. However, the connection string for integrated security does not allow you to impersonate a user. You should look for help on configuring your application to impersonate a specific account on an ASP.NET forum at: http://forums.asp.net/.

Thanks
Laurentiu

how to connect to sql server as other's window login rather than user's window login thoru

Dear members,

In MSDN, it says that it is recommended to use windows authentication to connect to SQL Server rather than use mixed authentication.

I create user delta\sqluser on windows OS, and I specify in my webform ASP.NET script below :

protected System.Web.UI.WebControls.Label Label1;
private string _connString = @."data source=delta\sql2000;initial catalog=northwind;integrated security=false;user id=delta\sqluser";
/*
comment : I login to my windows as delta\koronx, and I want to every user (including me), connected to sql server through IIS, will be identified as delta\sqluser not as user's login (impersonate)
*/
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection conn = new SqlConnection(_connString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select suser_sname()";

conn.Open();


string userName = cmd.ExecuteScalar() as string;
conn.Close();
conn.Close();
Label1.Text = userName;
}

at web.config, I add :
<identity impersonate="false" userName="delta\sqluser" password="" />

at IIS webApplication1's properties, tab "Directory Security", at "Authentication and access control" section, I checked "enable anonymous access" with user : DELTA\IUSR_DELTA and checked "Integrated Windows Authentication",

at query analyzer, I login as "sa" and execute script below :
exec sp_grantdbaccess 'delta\sqluser','northwind'

when I run the ASP.NET script, error at conn.Open(); with error message :
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

What should I do so that IIS login to SQL Server as user delta\sqluser not as "NT AUTHORITY\NETWORK SERVICE" ?

Regards,

Koronx

Your connection string is incorrect. You specify using SQL Authentication (integrated security = false) but what you want is integrated security. However, the connection string for integrated security does not allow you to impersonate a user. You should look for help on configuring your application to impersonate a specific account on an ASP.NET forum at: http://forums.asp.net/.

Thanks
Laurentiu

Monday, March 26, 2012

How to connect to AS 2000

Hi all,

Currently I am working on the Window 2003 Enterprise 64-bit with SQL 2005 Enterprise and Visual Studio Professional install. I try to write a console application using Visual Studio to connect to the Analysis Server 2000, but I get the follow error message:

ErrorTongue Tiedystem.Runtime.InteropServices.COMException (0x800A0E7A): Provider cannot be found. It may not be properly installed.
at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
at ExceptionCheck.Module1.Hodb03_ItemSales() in Z:\Visual Studio\Console\ExceptionCheck\ExceptionCheck\Module1.vb:line 16"

I know if I want to connect to the Analysis Service 2000, I need to install the Microsoft SQL Server 2000 PivotTable Services. After I install the services, I still get the error message.

Thanks,

Tomas

Hi,

Try to re-register msolap (regsvr32 msolap80.dll from "%ProgramFiles%\Common Files\System\Ole DB"). If you get the same error, let's check with the MDX Sample application (ships with AS2000, you can copy it from another machine). If you get the same error, then you probably have corrupted installation of the Pivot Table Service.

|||

Hi,

I tried to re-register msolap, but it didn't help.

|||The MDX Sample application failed with the same error ? Beside re-installing PTS, can't think of something else.

Friday, March 23, 2012

How To Connect Remote Server's DataBase from another's Server's QueryWindow

Please Help Me to do this...

Consider i hv already logged in

sql server 2005
ip no : 192.168.2.20
db name: framework

from this query window is it possible to access the objects(tables,stored porc's)
of another server's database

for example ,

sql server 2005
ip no : 192.168.2.21
db name: framework1

...................................................

Im able to access the same server's db objects
consider im frame work db
declare @.qry as nvarchar(max)
set @.qry= '
use [master]
select * from [Sales]
'
exec (@.qry)
... but when i use use statement like,(its not working)
use 192.168.2.21
use [master]

Please help me out .....

No it is not possible from that query window unless you use linked servers.

Take a look at: http://www.sqlservercentral.com/columnists/ksonti/anintroductiontolinkedservers.asp

Martin

|||If the servers are part of a replicated topology you will have to set the server option for data access to true,

is sp_serveroption 'ServerIWishToQuery','Data Access','True'

and then

select * from ServerIWishToQuery.Database.dbo.TableName|||Thank u Hilary...

It was really helpful...

as u said i executed

exec sys.sp_serveroption [192.168.2.20],'data access','true'

It is Giving this type of error ...

Msg 15015, Level 16, State 1, Procedure sp_serveroption, Line 101
The server '192.168.2.20' does not exist. Use sp_helpserver to show available servers.

I think we have to link the servers ..

can u please guide me how to do it.......

Friday, February 24, 2012

how to close results window in 2005 query analyzer?

Other than ctr-R, is there a way to close the results window after running a
query in 2005's query analyzer? In 2000 there was a "Show results Pane"
button. I can't find this button in 2005.
Thanks so much!
WalterHi,
It's there in 2005 also, In ToolBar under Window's option the 3rd one is
"Show result Pane"
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and
time
asking back if its 2000 or 2005]
"Walter Mallon" wrote:

> Other than ctr-R, is there a way to close the results window after running
a
> query in 2005's query analyzer? In 2000 there was a "Show results Pane"
> button. I can't find this button in 2005.
> Thanks so much!
> Walter
>
>|||Thanks!!!
Walter
"Sreejith G" <SreejithG@.discussions.microsoft.com> wrote in message
news:5B8747C2-FD80-4B83-B7A2-6D1E01D4C029@.microsoft.com...[vbcol=seagreen]
> Hi,
> It's there in 2005 also, In ToolBar under Window's option the 3rd one is
> "Show result Pane"
> --
> Thanks,
> Sree
> [Please specify the version of Sql Server as we can save one thread an
d
> time
> asking back if its 2000 or 2005]
>
> "Walter Mallon" wrote:
>

how to close results window in 2005 query analyzer?

Other than ctr-R, is there a way to close the results window after running a
query in 2005's query analyzer? In 2000 there was a "Show results Pane"
button. I can't find this button in 2005.
Thanks so much!
WalterHi,
It's there in 2005 also, In ToolBar under Window's option the 3rd one is
"Show result Pane"
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Walter Mallon" wrote:
> Other than ctr-R, is there a way to close the results window after running a
> query in 2005's query analyzer? In 2000 there was a "Show results Pane"
> button. I can't find this button in 2005.
> Thanks so much!
> Walter
>
>|||Thanks!!!
Walter
"Sreejith G" <SreejithG@.discussions.microsoft.com> wrote in message
news:5B8747C2-FD80-4B83-B7A2-6D1E01D4C029@.microsoft.com...
> Hi,
> It's there in 2005 also, In ToolBar under Window's option the 3rd one is
> "Show result Pane"
> --
> Thanks,
> Sree
> [Please specify the version of Sql Server as we can save one thread and
> time
> asking back if its 2000 or 2005]
>
> "Walter Mallon" wrote:
>> Other than ctr-R, is there a way to close the results window after
>> running a
>> query in 2005's query analyzer? In 2000 there was a "Show results Pane"
>> button. I can't find this button in 2005.
>> Thanks so much!
>> Walter
>>