 |
|
| .NET DotNet Forum Index » ADO .NET Forum » SQL Connection String... |
|
Page 1 of 1 |
|
| Author |
Message |
| Michael... |
Posted: Wed Sep 30, 2009 8:15 pm |
|
|
|
Guest
|
Hi,
I want to access a database which has a different owner. The database
name is the following: Domain\owner.DatabaseName. When I connect as
the Database owner i can just specify 'DatabaseName' as the name.
However when I try as a different user which has r/w access, I always
get the message 'Invalid object name'. I tried all combinations with
and without Domain\owner.
Thanks,
Michael |
|
|
| Back to top |
|
|
|
| Michael... |
Posted: Thu Oct 01, 2009 1:34 am |
|
|
|
Guest
|
On Oct 1, 6:09 pm, "Mark Rae [MVP]" <m... at (no spam) markNOSPAMrae.net> wrote:
Quote: "Michael" <m... at (no spam) dengl.com> wrote in message
news:bd362da0-72b4-4076-9d4c-ec596cdd926f at (no spam) b25g2000prb.googlegroups.com...
I want to access a database which has a different owner. The database
name is the following: Domain\owner.DatabaseName. When I connect as
the Database owner i can just specify 'DatabaseName' as the name.
However when I try as a different user which has r/w access, I always
get the message 'Invalid object name'. I tried all combinations with
and without Domain\owner.
You haven't actually told us which RDBMS this is, so:http://www.connectionstrings.com/
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Thank you. It is MS SQL. The database server is configured to accept
both Windows and SQL Server authentication.
When I specify a username and password (the owner of the database) in
the Connectionstring but different to the Windows user which connects
to it, I get the 'Invalid object name error' |
|
|
| Back to top |
|
|
|
| Mark Rae [MVP]... |
Posted: Thu Oct 01, 2009 5:09 am |
|
|
|
Guest
|
"Michael" <mail at (no spam) dengl.com> wrote in message
news:bd362da0-72b4-4076-9d4c-ec596cdd926f at (no spam) b25g2000prb.googlegroups.com...
Quote: I want to access a database which has a different owner. The database
name is the following: Domain\owner.DatabaseName. When I connect as
the Database owner i can just specify 'DatabaseName' as the name.
However when I try as a different user which has r/w access, I always
get the message 'Invalid object name'. I tried all combinations with
and without Domain\owner.
You haven't actually told us which RDBMS this is, so:
http://www.connectionstrings.com/
--
Mark Rae
ASP.NET MVP
http://www.markrae.net |
|
|
| Back to top |
|
|
|
| Mark Rae [MVP]... |
Posted: Thu Oct 01, 2009 6:01 am |
|
|
|
Guest
|
"Michael" <mail at (no spam) dengl.com> wrote in message
news:cdcc8f45-2cc8-4583-a69f-45b98db5a1b0 at (no spam) o10g2000yqa.googlegroups.com...
Quote: Thank you. It is MS SQL. The database server is configured to accept
both Windows and SQL Server authentication.
When I specify a username and password (the owner of the database) in
the Connectionstring but different to the Windows user which connects
to it, I get the 'Invalid object name error'
Does the owner of the database have a valid login on the server...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net |
|
|
| Back to top |
|
|
|
| Patrice... |
Posted: Thu Oct 01, 2009 10:57 am |
|
|
|
Guest
|
Show the connection string you are using.
Quote: The database
name is the following: Domain\owner.DatabaseName.
It should be just DatabaseName.
My understanding is that you are trying to connect to the database using
some other user :
- this is not done by appending this info before the database name.
- you have specific User ID and Password entry in the connection string (try
the site mentionned earlier for the details)
- If a domain account, you have a Integrated Secuirty=SSPI in the connection
string and impersontation is done at the ASP.NET level...
--
Patrice |
|
|
| Back to top |
|
|
|
| Gregory A. Beamer... |
Posted: Fri Oct 02, 2009 10:54 am |
|
|
|
Guest
|
Michael <mail at (no spam) dengl.com> wrote in news:bd362da0-72b4-4076-9d4c-
ec596cdd926f at (no spam) b25g2000prb.googlegroups.com:
Quote: Hi,
I want to access a database which has a different owner. The database
name is the following: Domain\owner.DatabaseName. When I connect as
the Database owner i can just specify 'DatabaseName' as the name.
However when I try as a different user which has r/w access, I always
get the message 'Invalid object name'. I tried all combinations with
and without Domain\owner.
Different owner or different schema?
If this is SQL Server 2000, then I can guarantee you mean owner. If SQL
Server 2005 or greater, you probably mean schema. For example, when I
create a database I can do the following:
CREATE SCHEMA Joe
CREATE SCHEMA Fred
I can then do this:
CREATE TABLE Joe.Person
(
PersonId int
, PersonName varchar(50)
)
AND
CREATE TABLE Fred.Person
(
PersonId int
, PersonName varchar(50)
)
Now, some databases may use the schema like the owner in 2000, but it is
incorrect.
Here's where the thinking gets tricky, so I will try to take you through
this. Users have a default schema in SQL Server. The "owner" of a schema
has that schema as his default (by default, I am not sure it HAS to be this
way -- but, that is why you can connect as that user without the schema in
front of the table name). It need not be like this, but it is a leftover
from previous versions of SQL Server, where there was an owner, not a
schema.
You can be set up to default to a certain schema, but it does not solve
your issue completely, as maintaining user schemas is time consuming.
The better option is to ALWAYS use schema names, even when the user is
defaulted to the schema. Okay, if the only schema you ever use is the
standard dbo, perhaps you can break this rule.
The short story is this: If you explicitly name the objects in
schema.object format, you can always connect. When you rely on defaults,
you have to make sure the user is defaulted correctly (this is an implicit
connection to an object rather than explicit). Explicit costs a bit more up
front (in typing), but saves a lot afterwards.
Peace and Grace,
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: at (no spam) gbworld
Blog: http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
******************************************* |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Thu Nov 26, 2009 8:51 pm
|
|