Showing posts with label admin. Show all posts
Showing posts with label admin. Show all posts

Tuesday, March 20, 2012

Accessing a remote SQL Server

Currently, I access a database and table that is not the current
database using Admin..CASES
INSERT INTO Admin..CASES
(CASE_CODE,CASE_NAME,CASE_CLASS_PERIOD_BEG_DATE,CA SE_CLASS_PERIOD_END_DATE,
CASE_DISTRIBUTION_DATE,CASE_URL) SELECT M.MailCode AS
CaseCode,C.CaseName, C.ClassPeriodBegDate, C.ClassPeriodEndDate,
C.DistributionDate, M.WebsiteAddr FROM CaseList C INNER JOIN
MailCode M ON M.CaseRef = C.CaseRef WHERE Admin='Gilardi & Co., LLC'
Admin is the DB and CASES is the table.
I now have a situation where Admin is on a remote Server at the
IP of 192.168.100.5.
What syntax should I use for the above query?
Todd
If you are able to register the remote server as a 'Linked Server', it will
be relatively simple. See Books Online for sp_AddLinkedServer.
Then, using a 'four-part' object name, with the Server name first (you are
currently using a three-part object name), try something like this:
INSERT INTO MyServer.Admin..CASES
etc.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Todd Cary" <todd@.aristesoftware.com> wrote in message
news:45257B52.9040208@.aristesoftware.com...
> Currently, I access a database and table that is not the current database
> using Admin..CASES
> INSERT INTO Admin..CASES
> (CASE_CODE,CASE_NAME,CASE_CLASS_PERIOD_BEG_DATE,CA SE_CLASS_PERIOD_END_DATE,
> CASE_DISTRIBUTION_DATE,CASE_URL) SELECT M.MailCode AS CaseCode,C.CaseName,
> C.ClassPeriodBegDate, C.ClassPeriodEndDate, C.DistributionDate,
> M.WebsiteAddr FROM CaseList C INNER JOIN MailCode M ON M.CaseRef =
> C.CaseRef WHERE Admin='Gilardi & Co., LLC'
> Admin is the DB and CASES is the table.
> I now have a situation where Admin is on a remote Server at the IP of
> 192.168.100.5.
> What syntax should I use for the above query?
> Todd
|||Arnie Rowland wrote:
> If you are able to register the remote server as a 'Linked Server', it will
> be relatively simple. See Books Online for sp_AddLinkedServer.
> Then, using a 'four-part' object name, with the Server name first (you are
> currently using a three-part object name), try something like this:
> INSERT INTO MyServer.Admin..CASES
> etc.
>
When I bring up the Registered SQL Server Properties in
Enterprise manager, I am not sure how to "Register" the server;
what to put in the Server edit box. If I put the IP in the
Server edit box, it does create an entry.
The docs speak of @.server= and @.datasrc=
Todd
|||Arnie Rowland wrote:
> If you are able to register the remote server as a 'Linked Server', it will
> be relatively simple. See Books Online for sp_AddLinkedServer.
> Then, using a 'four-part' object name, with the Server name first (you are
> currently using a three-part object name), try something like this:
> INSERT INTO MyServer.Admin..CASES
> etc.
>
I have tried
sp_AddLinkedServer @.server='GilardiDEV',
@.srvproduct='SQL Server',
@.datasrc='192.168.100.5'
But I get the error
"You must specify a provider name with this set of properties."
yet the docs say that for "SQL Server", a provider is not require.
Hmmmm....
Todd
|||Not sure about the docs but you need to add
@.provider='SQLOLEDB'
to create the linked server.
However...the bigger issue is that it looks like you have
linked server named ADMIN already created. So wouldn't your
question really be how do I change the linked server ADMIN
to point to a new IP address?
You can change the data source through Enterprise Manager
for the linked server. It will update the system tables
(sysservers) where the information is stored.
-Sue
On Thu, 05 Oct 2006 17:53:25 -0700, Todd Cary
<todd@.aristesoftware.com> wrote:

>Arnie Rowland wrote:
>I have tried
>sp_AddLinkedServer @.server='GilardiDEV',
>@.srvproduct='SQL Server',
>@.datasrc='192.168.100.5'
>But I get the error
>"You must specify a provider name with this set of properties."
>yet the docs say that for "SQL Server", a provider is not require.
>Hmmmm....
>Todd

Accessing a remote SQL Server

Currently, I access a database and table that is not the current
database using Admin..CASES
INSERT INTO Admin..CASES
(CASE_CODE,CASE_NAME,CASE_CLASS_PERIOD_B
EG_DATE,CASE_CLASS_PERIOD_END_DATE,
CASE_DISTRIBUTION_DATE,CASE_URL) SELECT M.MailCode AS
CaseCode,C.CaseName, C.ClassPeriodBegDate, C.ClassPeriodEndDate,
C.DistributionDate, M.WebsiteAddr FROM CaseList C INNER JOIN
MailCode M ON M.CaseRef = C.CaseRef WHERE Admin='Gilardi & Co., LLC'
Admin is the DB and CASES is the table.
I now have a situation where Admin is on a remote Server at the
IP of 192.168.100.5.
What syntax should I use for the above query?
ToddIf you are able to register the remote server as a 'Linked Server', it will
be relatively simple. See Books Online for sp_AddLinkedServer.
Then, using a 'four-part' object name, with the Server name first (you are
currently using a three-part object name), try something like this:
INSERT INTO MyServer.Admin..CASES
etc.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Todd Cary" <todd@.aristesoftware.com> wrote in message
news:45257B52.9040208@.aristesoftware.com...
> Currently, I access a database and table that is not the current database
> using Admin..CASES
> INSERT INTO Admin..CASES
> (CASE_CODE,CASE_NAME,CASE_CLASS_PERIOD_B
EG_DATE,CASE_CLASS_PERIOD_END_DATE
,
> CASE_DISTRIBUTION_DATE,CASE_URL) SELECT M.MailCode AS CaseCode,C.CaseName,
> C.ClassPeriodBegDate, C.ClassPeriodEndDate, C.DistributionDate,
> M.WebsiteAddr FROM CaseList C INNER JOIN MailCode M ON M.CaseRef =
> C.CaseRef WHERE Admin='Gilardi & Co., LLC'
> Admin is the DB and CASES is the table.
> I now have a situation where Admin is on a remote Server at the IP of
> 192.168.100.5.
> What syntax should I use for the above query?
> Todd|||Arnie Rowland wrote:
> If you are able to register the remote server as a 'Linked Server', it wil
l
> be relatively simple. See Books Online for sp_AddLinkedServer.
> Then, using a 'four-part' object name, with the Server name first (you are
> currently using a three-part object name), try something like this:
> INSERT INTO MyServer.Admin..CASES
> etc.
>
When I bring up the Registered SQL Server Properties in
Enterprise manager, I am not sure how to "Register" the server;
what to put in the Server edit box. If I put the IP in the
Server edit box, it does create an entry.
The docs speak of @.server= and @.datasrc=
Todd|||Arnie Rowland wrote:
> If you are able to register the remote server as a 'Linked Server', it wil
l
> be relatively simple. See Books Online for sp_AddLinkedServer.
> Then, using a 'four-part' object name, with the Server name first (you are
> currently using a three-part object name), try something like this:
> INSERT INTO MyServer.Admin..CASES
> etc.
>
I have tried
sp_AddLinkedServer @.server='GilardiDEV',
@.srvproduct='SQL Server',
@.datasrc='192.168.100.5'
But I get the error
"You must specify a provider name with this set of properties."
yet the docs say that for "SQL Server", a provider is not require.
Hmmmm....
Todd|||Not sure about the docs but you need to add
@.provider='SQLOLEDB'
to create the linked server.
However...the bigger issue is that it looks like you have
linked server named ADMIN already created. So wouldn't your
question really be how do I change the linked server ADMIN
to point to a new IP address?
You can change the data source through Enterprise Manager
for the linked server. It will update the system tables
(sysservers) where the information is stored.
-Sue
On Thu, 05 Oct 2006 17:53:25 -0700, Todd Cary
<todd@.aristesoftware.com> wrote:

>Arnie Rowland wrote:
>I have tried
>sp_AddLinkedServer @.server='GilardiDEV',
>@.srvproduct='SQL Server',
>@.datasrc='192.168.100.5'
>But I get the error
>"You must specify a provider name with this set of properties."
>yet the docs say that for "SQL Server", a provider is not require.
>Hmmmm....
>Todd

Sunday, March 11, 2012

Access to SQLServer Database from Visual C# app and ASP.NET app

I've created a visual C# GUI that logs data over a LAN. The GUI is for Admin purposes only so it logs data and stores it (plus some admin stuff). The data that is logged is supposed to be served up to anyone on the network as a web app. I've got an instance of SQLServer running and the GUI works great but I can't seem to get the web app to connect to the database to read and display the data for general users?

I'm new to ASP.NET and SQL Server so a little extra explanation or steps that I'm missing wouldn't hurt me if you have the time to spare.

I get an error that says "Cannot get web application service" in Visual Studio when I try and drag and drop a SQLDataSource onto my pages and configure it. It then asks me to Choose My DataConnection from the drop down and there's no connection there...

I tried setting it up in the code behind page like I would in Visual C# (small code example below) by adding in using System.Data.SqlClient; etc.. and it throws me a nasty notice (see below). Obviously it doesn't like this user but how do I fix this so I can server up my DB to work for both my GUI and ASP apps? I noticed when looking at my DB that the owner is TUDOR\Windows is there a way to have multiple owners to a DB if this is what's wrong?

String conn = @."Server=TUDOR\sqlexpress;" +

"Integrated Security=True;" +

"Database=ATSDB";

// Specify SQL Server-specific connection string

SqlConnection dbconn = new SqlConnection(conn);

// Create DataAdapter object

SqlDataAdapter dbadpt = new SqlDataAdapter("SELECT FirstName FROM tblPersonInfo WHERE FirstName = 'Kim'", dbconn);

// Create CommandBuilder object to build SQL commands

SqlCommandBuilder dbcmd = new SqlCommandBuilder(dbadpt);

// Create DataSet to contain related data tables, rows, and columns

DataSet dbset = new DataSet();

// Fill DataSet using query defined previously for DataAdapter

dbadpt.Fill(dbset, "tblPersonInfo");

Server Error in '/ATS' Application.

Cannot open database "ATSDB" requested by the login. The login failed.
Login failed for user 'TUDOR\ASPNET'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database "ATSDB" requested by the login. The login failed.
Login failed for user 'TUDOR\ASPNET'.
Source Error:
Line 32: Line 33: // Fill DataSet using query defined previously for DataAdapter Line 34: dbadpt.Fill(dbset, "tblPersonInfo"); Line 35: } Line 36: }

Source File: c:\Inetpub\wwwroot\ATS\text\Default2.aspx.cs Line: 34 Hi there,

ASP.NET web applications, by default, will run under their own account. In your case, this account seems to be TUDOR\ASPNET.

The problem seems to be that this account is not set up as a login in SQL Server. You need to create a login for TUDOR\ASPNET for your SQL Server and give it access to the required databases.

You can do this by (sorry if you already know this bit):

1) Open Management Studio Express (I presume from reading your code that you are using SQL Server Express Edition) and connect to your SQL Server Instance

2) Expand the node for your SQL Server instance and you will see a node labelled "Security"

3) Right click on the "Security" node and select "New > Login" from the context menu that appears

4) A new dialog window will appear. Enter "TUDOR\ASPNET" as the user and make sure that the Windows Authentication radio button is selected. Set the default database as required (in your case this will probably be ATSDB)

5) In the dialog, on the left hand side there should be an item called "Server Roles". Click on this and then define whatever server roles (e.g. sysadmin) TUDOR\ASPNET will have....What roles the user'll have is entirely up to you

6) In the dialog, on the left hand side there should be an item called "User Mapping". Click on this and then select which databases TUDOR\ASPNET will have access to (in your case, most definately select ATSDB). Also, select what database role (e.g. dbowner) the account will have....Once again, this is up to you to determine

7) Nothing else is particularly interesting so just click OK to finish the process

After you have given access to TUDOR\ASPNET to your SQL Server, you should be able to use your ASP.NET application without getting that error.

Hope that helps a bit, but sorry if it doesn't
|||That sounds like exactly what I need to do. I am using Sql Server Express, from what I've read that is what comes with Visual Studio 2005 but I can't find Management Studio Express? Is that something that only comes with Express Edition software? When I was asked to do this I went out and bought some O'Reilly books but I also bought a couple Express Edition books so I could get up and going fast so if the code looks unelegant that might be why or maybe it was the /SQLExpress that gave it away. Thanks for all the notes I didn't know how to do all that and if I can find Management Studio Express that would definetly solve all my problems. Is it under something else in Visual Studio 2005 Pro Edition?|||Hi there,

Management Studio Express is a seperate download. You can get it from the below link.

SQL Server Express Edition Downloads

After you download & install it, you should be good to go. When Management Studio asks you to connect, your server name, by reading your code should be TUDOR\SQLEXPRESS.

Using Management Studio Express you can connect via SQL Server Authentication (using an account like "sa") or Windows Authentication. If you connect via Windows Authentication but find you can't modify users then your account probably does not have the required privileges. If you switch to the "sa" account you should be fine.

Hope that helps a bit.
|||Thanks so much for your help and your explanations. That's a lot of typing to do to help out someone you don't know. Much appreciated. Works great.

Monday, February 13, 2012

Access in AS Database

I have a scenario where I need to give access for one of my subordinate to the AS database on my AS Server. He should have the ADMIN rights to only that AS database. I cant give him rights to the Server box as it contains other AS databases too. Is it possible to give him such rights in AS 2000. so that he registers the server from any other machine and gets to see only that database. Also can we restrict his rights to cube level if we want to do so.

Thanks in Advance,
siaj

Hi,

You will need to create the database yourself (because this requires admin per server) and inside the database create a Role containing your subordinate account. Then, for that Role specify admin permissions for the database.

After this, the subordinate can connect to your server and he will be able to fill the database with dimensions, cubes, mining structures etc. However, he needs to be carefull to not delete that database Role (who contains him as member) or he will cut his access. Therefore, if the subordinate will use a BI project to deploy, he needs to make sure that the project contains the Role definition. If he will connect to the database to adminsiter it online, there shouldn't be problems.

Adrian Dumitrascu.

Saturday, February 11, 2012

Access for the user

Dear Friends
I want to create a user for one database in the server so that he can do all
the admin task such as Backup, Restore, Modification for table, Proceduers,
Views and Functions.
But should not have access to another databases. Please suggest how i can do
the same.
Best regardsHi,
Assign the DB_OWNER database fixed role to the user. This will allow him the
admin tasks in that particular database.
Thanks
Hari
SQL Server MVP
"Sharad2005" <niitmalad@.yahoo.co.uk> wrote in message
news:16CA54CC-25A9-49FE-A9B4-001C0E0ED96E@.microsoft.com...
> Dear Friends
> I want to create a user for one database in the server so that he can do
> all
> the admin task such as Backup, Restore, Modification for table,
> Proceduers,
> Views and Functions.
> But should not have access to another databases. Please suggest how i can
> do
> the same.
> Best regards
>

Access for the user

Dear Friends
I want to create a user for one database in the server so that he can do all
the admin task such as Backup, Restore, Modification for table, Proceduers,
Views and Functions.
But should not have access to another databases. Please suggest how i can do
the same.
Best regards
Hi,
Assign the DB_OWNER database fixed role to the user. This will allow him the
admin tasks in that particular database.
Thanks
Hari
SQL Server MVP
"Sharad2005" <niitmalad@.yahoo.co.uk> wrote in message
news:16CA54CC-25A9-49FE-A9B4-001C0E0ED96E@.microsoft.com...
> Dear Friends
> I want to create a user for one database in the server so that he can do
> all
> the admin task such as Backup, Restore, Modification for table,
> Proceduers,
> Views and Functions.
> But should not have access to another databases. Please suggest how i can
> do
> the same.
> Best regards
>

Access for the user

Dear Friends
I want to create a user for one database in the server so that he can do all
the admin task such as Backup, Restore, Modification for table, Proceduers,
Views and Functions.
But should not have access to another databases. Please suggest how i can do
the same.
Best regardsHi,
Assign the DB_OWNER database fixed role to the user. This will allow him the
admin tasks in that particular database.
Thanks
Hari
SQL Server MVP
"Sharad2005" <niitmalad@.yahoo.co.uk> wrote in message
news:16CA54CC-25A9-49FE-A9B4-001C0E0ED96E@.microsoft.com...
> Dear Friends
> I want to create a user for one database in the server so that he can do
> all
> the admin task such as Backup, Restore, Modification for table,
> Proceduers,
> Views and Functions.
> But should not have access to another databases. Please suggest how i can
> do
> the same.
> Best regards
>

access deny the sa account

After install msde and create another user with system admin authority, is
it possible to disable the account sa to access the system for security
reason?
I have tried using sp_denylogin / sp_revokelogin but both failure. Thanks
in advance for any suggestion
hi Thomas
"Thomas Tsang" <thomast@.hkc.net> ha scritto nel messaggio
news:OdxjCVKwEHA.1308@.TK2MSFTNGP09.phx.gbl
> After install msde and create another user with system admin
> authority, is it possible to disable the account sa to access the
> system for security reason?
> I have tried using sp_denylogin / sp_revokelogin but both failure.
> Thanks in advance for any suggestion
sp_denylogin and sp_revokelogin only work with Windows NT users/groups and
not with SQL Server logins.
anyway, you can not disable "sa" login..
I know folks that renamed it directly in sysxlogins system table, but this
is not very polite :D , nor is supported..
the standard way to "disable" it is to assign it a random generated 128
chars password, so that no one knows it..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Thank for your information
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> bl
news:2upbhrF2b83gdU1@.uni-berlin.de g...
> hi Thomas
> "Thomas Tsang" <thomast@.hkc.net> ha scritto nel messaggio
> news:OdxjCVKwEHA.1308@.TK2MSFTNGP09.phx.gbl
> sp_denylogin and sp_revokelogin only work with Windows NT users/groups and
> not with SQL Server logins.
> anyway, you can not disable "sa" login..
> I know folks that renamed it directly in sysxlogins system table, but this
> is not very polite :D , nor is supported..
> the standard way to "disable" it is to assign it a random generated 128
> chars password, so that no one knows it..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>

Thursday, February 9, 2012

access denied for query analyzer

The sqlserver 2000 was installed on the box
using a domain usr account which is in local admin group.
A local user account logged on and tried to launch query
analyzer and got access denied. How to fix this problem
so that the local users can have launch the sqlserver
software? Any help will be appreciated.you need to grant the user the login permission onto sql server and the
login needs to be mapped to a database user or granted permissions or added
to a database roles.
Check sql books online sp_grantlogin and sp_addlogin , sp_grantdbaccess
--
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Wen Chang" <wchang@.siac.com> wrote in message
news:036001c3dde0$d0049580$a001280a@.phx.gbl...
> The sqlserver 2000 was installed on the box
> using a domain usr account which is in local admin group.
> A local user account logged on and tried to launch query
> analyzer and got access denied. How to fix this problem
> so that the local users can have launch the sqlserver
> software? Any help will be appreciated.
>

access denied for query analyzer

The sqlserver 2000 was installed on the box
using a domain usr account which is in local admin group.
A local user account logged on and tried to launch query
analyzer and got access denied. How to fix this problem
so that the local users can have launch the sqlserver
software? Any help will be appreciated.you need to grant the user the login permission onto sql server and the
login needs to be mapped to a database user or granted permissions or added
to a database roles.
Check sql books online sp_grantlogin and sp_addlogin , sp_grantdbaccess
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Wen Chang" <wchang@.siac.com> wrote in message
news:036001c3dde0$d0049580$a001280a@.phx.gbl...
quote:

> The sqlserver 2000 was installed on the box
> using a domain usr account which is in local admin group.
> A local user account logged on and tried to launch query
> analyzer and got access denied. How to fix this problem
> so that the local users can have launch the sqlserver
> software? Any help will be appreciated.
>