Home All Groups Group Topic Archive Search About

Something is wrong in my SQL ConnectionString but what?

Author
20 Mar 2006 8:44 AM
Mesut
Hi Colleagues,

I hope someone can help me what I'm doing wrong...

I filled in my connection string in my application see below and I
would like to open my Connection to my SQL database file. I try to open
my connection and I get the next error message. I tried to change some
values in my connection string but I still get the same error.
Everything is on my standalone laptop, I use Windows XP (Stand Alone)
and I use a simple userid to login: "demir"  (no password). I have
installed VB.NET Express Edition and SQL 2005 Express Edition (both
packages are free downloadable from Microsoft site)

Has it to do because of FREE SQL? limited SQL? I can't imagine it....

Can someone please advice what is wrong in my SqlConnection string or
somewhere else.....

This is my code in VB.NET 2005 Express Edition (Visual Studio)

Imports System.Data.Sqlclient
===> this gives an error
con.ConnectionString = "data source=LOCALHOST;initial
catalog=C:\Documents and Settings\Mesut\My
Documents\myDatabaseFile;password="""";persist security info=True;user
id=demir;workstation id=DEMIR;Packet Size=4096"

===> and this also gives an error...
con.ConnectionString = "data source=LOCALHOST;initial
catalog=myDatabaseFile;password="""";persist security info=True;user
id=demir;workstation id=;Packet Size=4096"

con.Open()

This is the errror message when I try to open the connection...
-->
An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error:40 - Could not
open a connection to SQL Server)

Author
20 Mar 2006 7:28 PM
Mesut
I found the problem, this is my new sqlConnection STRING:
con.ConnectionString = "Data Source=.\SQLEXPRESS;Initial
Catalog=myDatabase ;Integrated Security=True;Connect Timeout=30;User
Instance=True"

but this happens now:
Cannot open database"myDatabase" reauested by the login. The login
failed.
Login failed for user'DEMIR\Mesut'

DEMIR = my computer name and Mesut is my login name

I checked these sites, but I can't find the reason, it seems to be user
id Mesut is not authorized to use the database. I'm using SQL Express
Edition 2005, and I can't find the please to authorize userid id  Mesut
to the database.

Does someone know ?

checked sites:
http://support.microsoft.com/default.aspx?scid=kb;en-us;889615
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_47u6.asp
Author
20 Mar 2006 7:45 PM
Sericinus hunter
Mesut wrote:
> I found the problem, this is my new sqlConnection STRING:
> con.ConnectionString = "Data Source=.\SQLEXPRESS;Initial
> Catalog=myDatabase ;Integrated Security=True;Connect Timeout=30;User
> Instance=True"
>
> but this happens now:
> Cannot open database"myDatabase" reauested by the login. The login
> failed.
> Login failed for user'DEMIR\Mesut'
>
> DEMIR = my computer name and Mesut is my login name

    With integrated security, you should be a domain user. Is your
computer a part of domain?
Author
20 Mar 2006 9:24 PM
Mesut
I think not. I use standalone PC, Windows XP installed. (no network)
I removed integrated security keyword, I get the same message.....
Login Failed.
thanks again,
Mesut
Author
20 Mar 2006 10:56 PM
Sericinus hunter
Mesut wrote:
> I think not. I use standalone PC, Windows XP installed. (no network)
> I removed integrated security keyword, I get the same message.....
> Login Failed.
> thanks again,
> Mesut

    Then you have to create an account on the SQL Server with username
and password, and specify these credentials in your connection string.
Author
21 Mar 2006 8:59 AM
Mesut
I thought the same so I looked in my SQL Configuration manager I don't
see any menu options to add my account....
I'm using MS SQL 2005 Express Edition...

When I click on SQL Server Configuration Manager
I see there 3 options and I can't add any userid or whatever...
- SQL Server 2005 Services
- SQL Server 2005 Network Configuration
- SQL Native Client Configuration

Sevices started:
============
Name                                       State        Log On As
SQL Server (SQLEXPRESS)      Running    NT AUTHORITY\NetworkService
SQL Server Browser                  Running    NT
AUTHORITY\NetworkService

Can you please advice how I can open the Database in my program?

regards,

Mesut
Author
21 Mar 2006 3:05 PM
Sericinus hunter
Mesut wrote:
Show quote
> I thought the same so I looked in my SQL Configuration manager I don't
> see any menu options to add my account....
> I'm using MS SQL 2005 Express Edition...
>
> When I click on SQL Server Configuration Manager
> I see there 3 options and I can't add any userid or whatever...
> - SQL Server 2005 Services
> - SQL Server 2005 Network Configuration
> - SQL Native Client Configuration
>
> Sevices started:
> ============
> Name                                       State        Log On As
> SQL Server (SQLEXPRESS)      Running    NT AUTHORITY\NetworkService
> SQL Server Browser                  Running    NT
> AUTHORITY\NetworkService
>
> Can you please advice how I can open the Database in my program?

    Unfortunately, I don't have Express Edition handy, maybe it does not
have GUI for creating users, roles and such. These are database objects
like tables or stored procedures, so you can create user logins just
executing plain SQL.

AddThis Social Bookmark Button