Showing posts with label pro. Show all posts
Showing posts with label pro. Show all posts

Wednesday, March 7, 2012

How to add a new .mdf with ONLY sql authentication in SQL Express?

Hi all.

I am going around in circles all day on this.

I have a clean new install of win XP SP2, VS 2005 Pro RTM,
and a NAMED instance of Sql Express with mixed authentication mode specified at setup.
The sa pw is 123456

I would have liked just SQL authentication but no such option.

I am trying to add a new mdf file. If I just use the "Add New Item" in VS web app project it just adds a new .mdf file with windows authentication tied to the current profile I am logged in the os with. I am trying to avoid that as this projects is to be zipped and downloaded as a sample app. I am also trying to avoid embedding an instance of SSE as the recipients of the zip file already have SSE running iwth thei VS IDE.

So most logical is to create the file with SQL authentication.
I have to do it by the Add Connection GUI

and for data source: "Microsoft SQL Server Database File (SqlClient) "

for data file name: C:\WebSites\Website1\App_Data\MyDatabase1.mdf (not yet existing file)

Use SQl server authentication:

user: sa, password: 123456 (the ones specified at set up of the SSE)

I keep getting

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.

I keep getting the same error no matter what username I use or password, the current login, etc. It just does not let me use sql authentication.

Please help anyone. This is a nightmare.

"Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection."

This seems that you didn′t activate Mmixed Authentication, its an error you are getting if you only specified the Windows Authentication. Try setting the authentication mode for the express instance:

<snip>
Another way to change the security mode after installation is to stop
SQL Server and set the appropriate registry key for your installation:

Default instance:
HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode

Named instance:
HKLM\Software\Microsoft\Microsoft SQL Server\Instance
Name\MSSQLServer\LoginMode

to 2 for mixed-mode or 1 for integrated. (Integrated is the default
setup for the SQL Server 2000 Data Engine.)
</snip>

HTH, Jens Suessmeyer.

|||

Thanks Jens,

1. I made sure during the install I selected mixed mode.

2. This article essentially says the same. However, I cannot find in the registry any "LoginMode" subkey for either the default SQLEXPRESS, or MySSE named instance.

Actually I did a complete search and there is no Key, Value or Data that contains "LoginMode" in the whole registry.

|||

You can interrogate the database engine with the CTP SQL Express Mamnagement Suite downloadable from Microsoft.

Click select the database engine..... right click and select export

You'll get a file like this:

<?xml version="1.0" encoding="utf-8"?>
<Export serverType="8c91a03d-f9b4-46c0-a305-b5dcc79ff907">
<ServerType id="8c91a03d-f9b4-46c0-a305-b5dcc79ff907" name="Database Engine">
<Server name="Shhhh\sqlexpress" description="Local instance - 'bliss\sqlexpress'">
<ConnectionInformation>
<ServerType>8c91a03d-f9b4-46c0-a305-b5dcc79ff907</ServerType>
<ServerName>Shhhh\sqlexpress</ServerName>
<AuthenticationType>0</AuthenticationType>
<UserName />
<Password />
<AdvancedOptions />
</ConnectionInformation>
</Server>
</ServerType>
</Export>

You'll see that ny authentication type is 0 which is windows authentification.

I ust went through this and there is a way to attach this programattically.

Use the Sql Management Classes in your code....

Create an XP UserGroup and user using the SMO classes. Then create the same user group in and user in the database and Attach it. It never fails and yes... I know how frustrating this is. I lost a lost of sleep over this this weekend.

Check out the thread in the first forum of this board for more information.

Renee

|||

Thanks Rene,

I learned something. I don't need the SSMSE becuase I have the full version installed too.

However I still can't fix the problem. This is what I have done so far:

I exported a .regservr and the xml looks just like you show. authetication 0. So I went back and looked in the registry again. I found a LoginMode subkey but in a different key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.4\MSSQLServer

It didn't quite make sense, because I am trying to change a NAMED instance. As expected it did not work. The exported .regsrvr still shows the same authentication mode 0.

I am scared to start adding registry keys that do not even exist.

The nightmare continues.


|||

Carl,

You are doing this programmatically?

|||

I meant to ask you about a link to the thread you mentioned.

What do you mean programmatically?

Create a c# app that could access and modify these registry keys in code? in which case NO.|||

Not true.... I spent the weekend working on this and a friend really helped my understand. You can do excellent work with SSE.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=223272&SiteID=1&PageID=0

post an email adress and I will send you the solution.

|||

http://msdn2.microsoft.com/microsoft.sqlserver.management.smo.server.attachdatabase.aspx

http://msdn2.microsoft.com/ms160723.aspx

|||

oh yeah. . . you can't do SQL authentication only.

its either windows or mixed mode

Sunday, February 19, 2012

How To Access Visual FoxPro Data from SQL Server ?

I'm trying to access Visual Fox Pro Data from Sql Server 2000, Can
anyone have any Idea ?

Thanks<mohd.osman@.gmail.com> wrote in message
news:1105059038.905785.50960@.f14g2000cwb.googlegro ups.com...
> I'm trying to access Visual Fox Pro Data from Sql Server 2000, Can
> anyone have any Idea ?
> Thanks

You could use a linked server or DTS, or if you can export the data to flat
files, then bcp.exe or DTS can import it. There are a number of newsgroup
posts about this, so you might want to check them out:

http://groups.google.co.uk/groups?q...G=Google+Search

Simon

How to access SQL Server 2005 with Query Analyzer (SQL 2000)

I'm not able to run queries on a MS SQL Server 2005 using the Query Analyzer
from an XP Pro machine running MS SQL 2000. I'm able to connect to the SQL
2005 server and display all objects in the Object Browser but can't run a
simple query. Any ideas?
By the way, I'm connecting with a new SQL account I created in SQL 2005 with
full rights.
What error message(s) are you getting?
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Sal Young" <SalYoung@.discussions.microsoft.com> wrote in message
news:9BCEACF4-3E33-48B2-AB00-70AF2D087F5D@.microsoft.com...
> I'm not able to run queries on a MS SQL Server 2005 using the Query
> Analyzer
> from an XP Pro machine running MS SQL 2000. I'm able to connect to the
> SQL
> 2005 server and display all objects in the Object Browser but can't run a
> simple query. Any ideas?
> By the way, I'm connecting with a new SQL account I created in SQL 2005
> with
> full rights.
|||I'm running the following select statement to get a table does not exist error:
SELECT * FROM Address
"Gail Erickson [MS]" wrote:

> What error message(s) are you getting?
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Sal Young" <SalYoung@.discussions.microsoft.com> wrote in message
> news:9BCEACF4-3E33-48B2-AB00-70AF2D087F5D@.microsoft.com...
>
>
|||Sal Young wrote:
> I'm running the following select statement to get a table does not
> exist error:
> SELECT * FROM Address
>
I believe this was already addressed in another post (unless we're
dealing with two identifical posts from two users).
SQL Server databases use the concept of schemas. That is, objects may or
may not be owned by "dbo" - the general default from prior SQL versions.
Because of this, the schema must be supplied so SQL Server knows where
to look. The Address table in the AdventureWorks database is contained
in the Person schema. So try:
Select * from Person.Address
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||Query Analyzer does not fully support new SQL Server 2005 features. For
example, it does not recognize schema names in the Object Browser. So when
you look at the AdventureWorks objects in the Object Browser of QA, they all
appear to belong to dbo even though very few objects actually do. If you
want to continue to use QA for 2005 databases, you'll need to keep that in
mind. The SQL Server 2005 Books Online topic "AdventureWorks Data
Dictionary" lists all the tables and the schemas they are contained in.
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:%234sqZta1FHA.4032@.TK2MSFTNGP15.phx.gbl...
> Sal Young wrote:
> I believe this was already addressed in another post (unless we're dealing
> with two identifical posts from two users).
> SQL Server databases use the concept of schemas. That is, objects may or
> may not be owned by "dbo" - the general default from prior SQL versions.
> Because of this, the schema must be supplied so SQL Server knows where to
> look. The Address table in the AdventureWorks database is contained in the
> Person schema. So try:
> Select * from Person.Address
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
|||I may just be me but I honestly think the SQL Server Management Studio is one
of the worst tool I have ever used. I wish they still had enterprise manager
and query analyzer for 2005. The new tools are so slow an bloated.
"Gail Erickson [MS]" wrote:

> Query Analyzer does not fully support new SQL Server 2005 features. For
> example, it does not recognize schema names in the Object Browser. So when
> you look at the AdventureWorks objects in the Object Browser of QA, they all
> appear to belong to dbo even though very few objects actually do. If you
> want to continue to use QA for 2005 databases, you'll need to keep that in
> mind. The SQL Server 2005 Books Online topic "AdventureWorks Data
> Dictionary" lists all the tables and the schemas they are contained in.
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "David Gugick" <david.gugick-nospam@.quest.com> wrote in message
> news:%234sqZta1FHA.4032@.TK2MSFTNGP15.phx.gbl...
>
>